Skip to content

Commit

Permalink
chore: enable more arch unit rules
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Jun 20, 2024
1 parent 3d0c9c7 commit 78b9e73
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

public class ResourceNotFoundException extends RuntimeException {

private static final HttpStatus httpStatus = HttpStatus.NOT_FOUND;
private static final HttpStatus HTTP_STATUS = HttpStatus.NOT_FOUND;

public ResourceNotFoundException(String errorMessage) {
super(errorMessage);
}

public HttpStatusCode getHttpStatus() {
return httpStatus;
return HTTP_STATUS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static com.tngtech.archunit.library.GeneralCodingRules.NO_CLASSES_SHOULD_USE_JAVA_UTIL_LOGGING;
import static com.tngtech.archunit.library.GeneralCodingRules.NO_CLASSES_SHOULD_USE_JODATIME;

import com.tngtech.archunit.core.domain.JavaModifier;
import com.tngtech.archunit.core.importer.ImportOption;
import com.tngtech.archunit.junit.AnalyzeClasses;
import com.tngtech.archunit.junit.ArchTest;
Expand Down Expand Up @@ -48,14 +49,18 @@ class GeneralCodingRulesTest {
.haveName("LOGGER")
.because("Logger variables should be private, static and final, and it should be named as LOGGER");

/*
@ArchTest
static final ArchRule finalStaticVariablesInUppercase = fields().that().areStatic().and().areFinal()
.and().doNotHaveName("serialVersionUID")
.and().doNotHaveModifier(JavaModifier.SYNTHETIC)
.should().haveNameMatching(".*^[A-Z].*")
static final ArchRule finalStaticVariablesInUppercase = fields().that()
.areStatic()
.and()
.areFinal()
.and()
.doNotHaveName("serialVersionUID")
.and()
.doNotHaveModifier(JavaModifier.SYNTHETIC)
.should()
.haveNameMatching(".*^[A-Z].*")
.because("Variables with static and final modifiers should be named in uppercase");
*/

// Methods
@ArchTest
Expand Down

0 comments on commit 78b9e73

Please sign in to comment.