Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mnhock committed Jun 18, 2024
1 parent 3272bc9 commit eb44c8f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import com.tngtech.archunit.lang.ConditionEvents;
import com.tngtech.archunit.lang.SimpleConditionEvent;

public final class JavaPredicates {
public final class GeneralPredicates {

private JavaPredicates() {
private GeneralPredicates() {
}

public static DescribedPredicate<CanBeAnnotated> annotatedWith(String annotation,
Expand All @@ -26,6 +26,15 @@ public boolean test(CanBeAnnotated canBeAnnotated) {
};
}

public static DescribedPredicate<JavaClass> areFinal() {
return new DescribedPredicate<>("are final") {
@Override
public boolean test(JavaClass javaClass) {
return javaClass.getModifiers().contains(JavaModifier.FINAL);
}
};
}

public static ArchCondition<JavaMethod> notDeclareThrownExceptions() {
return new ArchCondition<>("not declare thrown exceptions") {
@Override
Expand Down Expand Up @@ -54,15 +63,6 @@ public void check(JavaField field, ConditionEvents events) {
};
}

public static DescribedPredicate<JavaClass> areFinal() {
return new DescribedPredicate<>("are final") {
@Override
public boolean test(JavaClass javaClass) {
return javaClass.getModifiers().contains(JavaModifier.FINAL);
}
};
}

public static ArchCondition<JavaClass> beFinal() {
return new ArchCondition<>("be final") {
@Override
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/enofex/taikai/java/JavaConfigurer.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.enofex.taikai.java;

import static com.enofex.taikai.JavaPredicates.areFinal;
import static com.enofex.taikai.JavaPredicates.beFinal;
import static com.enofex.taikai.JavaPredicates.notBePublic;
import static com.enofex.taikai.GeneralPredicates.areFinal;
import static com.enofex.taikai.GeneralPredicates.beFinal;
import static com.enofex.taikai.GeneralPredicates.notBePublic;
import static com.enofex.taikai.java.Deprecations.notUseDeprecatedAPIs;
import static com.enofex.taikai.java.HashCodeAndEquals.implementHashCodeAndEquals;
import static com.enofex.taikai.java.NoSystemOutOrErr.notUseSystemOutOrErr;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/enofex/taikai/java/UtilityClasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static GivenClassesConjunction utilityClasses() {
return classes().that(haveOnlyStaticMethods());
}

static DescribedPredicate<JavaClass> haveOnlyStaticMethods() {
private static DescribedPredicate<JavaClass> haveOnlyStaticMethods() {
return new DescribedPredicate<>("have only static methods") {
@Override
public boolean test(JavaClass javaClass) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.enofex.taikai.spring;

import static com.enofex.taikai.JavaPredicates.annotatedWith;
import static com.enofex.taikai.GeneralPredicates.annotatedWith;

import com.tngtech.archunit.base.DescribedPredicate;
import com.tngtech.archunit.core.domain.properties.CanBeAnnotated;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/enofex/taikai/test/JUnit5Configurer.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.enofex.taikai.test;

import static com.enofex.taikai.JavaPredicates.notDeclareThrownExceptions;
import static com.enofex.taikai.GeneralPredicates.notDeclareThrownExceptions;
import static com.enofex.taikai.test.JUnit5Predicates.ANNOTATION_DISABLED;
import static com.enofex.taikai.test.JUnit5Predicates.ANNOTATION_DISPLAY_NAME;
import static com.enofex.taikai.test.JUnit5Predicates.ANNOTATION_PARAMETRIZED_TEST;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/enofex/taikai/test/JUnit5Predicates.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.enofex.taikai.test;

import static com.enofex.taikai.JavaPredicates.annotatedWith;
import static com.enofex.taikai.GeneralPredicates.annotatedWith;

import com.tngtech.archunit.base.DescribedPredicate;
import com.tngtech.archunit.core.domain.properties.CanBeAnnotated;
Expand All @@ -12,7 +12,6 @@ final class JUnit5Predicates {
static final String ANNOTATION_DISABLED = "org.junit.jupiter.api.Disabled";
static final String ANNOTATION_DISPLAY_NAME = "org.junit.jupiter.api.DisplayName";


private JUnit5Predicates() {
}

Expand Down

0 comments on commit eb44c8f

Please sign in to comment.