Skip to content

Commit

Permalink
Add missing configuration overload methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mnhock committed Sep 23, 2024
1 parent c543951 commit f03a3f5
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 24 deletions.
52 changes: 51 additions & 1 deletion src/main/java/com/enofex/taikai/java/JavaConfigurer.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public JavaConfigurer methodsShouldNotDeclareException(String regex,
return methodsShouldNotDeclareException(regex, clazz.getName(), defaultConfiguration());
}

public JavaConfigurer methodsShouldNotDeclareException(String regex,
Class<? extends Throwable> clazz, Configuration configuration) {
return methodsShouldNotDeclareException(regex, clazz.getName(), configuration);
}

public JavaConfigurer methodsShouldNotDeclareException(String regex, String typeName) {
return methodsShouldNotDeclareException(regex, typeName, defaultConfiguration());
}
Expand All @@ -88,6 +93,13 @@ public JavaConfigurer methodsShouldBeAnnotatedWithAll(Class<? extends Annotation
requiredAnnotationTypes.stream().map(Class::getName).toList(), defaultConfiguration());
}

public JavaConfigurer methodsShouldBeAnnotatedWithAll(Class<? extends Annotation> annotationType,
Collection<Class<? extends Annotation>> requiredAnnotationTypes,
Configuration configuration) {
return methodsShouldBeAnnotatedWithAll(annotationType.getName(),
requiredAnnotationTypes.stream().map(Class::getName).toList(), configuration);
}

public JavaConfigurer methodsShouldBeAnnotatedWithAll(String annotationType,
Collection<String> requiredAnnotationTypes) {
return methodsShouldBeAnnotatedWithAll(annotationType, requiredAnnotationTypes,
Expand Down Expand Up @@ -150,13 +162,19 @@ public JavaConfigurer classesShouldResideOutsidePackage(String regex, String pac
regex, packageIdentifier)), configuration));
}


public JavaConfigurer classesShouldBeAnnotatedWithAll(Class<? extends Annotation> annotationType,
Collection<Class<? extends Annotation>> requiredAnnotationTypes) {
return classesShouldBeAnnotatedWithAll(annotationType.getName(),
requiredAnnotationTypes.stream().map(Class::getName).toList(), defaultConfiguration());
}

public JavaConfigurer classesShouldBeAnnotatedWithAll(Class<? extends Annotation> annotationType,
Collection<Class<? extends Annotation>> requiredAnnotationTypes,
Configuration configuration) {
return classesShouldBeAnnotatedWithAll(annotationType.getName(),
requiredAnnotationTypes.stream().map(Class::getName).toList(), configuration);
}

public JavaConfigurer classesShouldBeAnnotatedWithAll(String annotationType,
Collection<String> requiredAnnotationTypes) {
return classesShouldBeAnnotatedWithAll(annotationType, requiredAnnotationTypes,
Expand All @@ -178,6 +196,11 @@ public JavaConfigurer classesShouldBeAnnotatedWith(String regex,
return classesShouldBeAnnotatedWith(regex, annotationType.getName(), defaultConfiguration());
}

public JavaConfigurer classesShouldBeAnnotatedWith(String regex,
Class<? extends Annotation> annotationType, Configuration configuration) {
return classesShouldBeAnnotatedWith(regex, annotationType.getName(), configuration);
}

public JavaConfigurer classesShouldBeAnnotatedWith(String regex, String annotationType) {
return classesShouldBeAnnotatedWith(regex, annotationType, defaultConfiguration());
}
Expand All @@ -196,6 +219,11 @@ public JavaConfigurer classesShouldNotBeAnnotatedWith(String regex,
return classesShouldNotBeAnnotatedWith(regex, annotationType.getName(), defaultConfiguration());
}

public JavaConfigurer classesShouldNotBeAnnotatedWith(String regex,
Class<? extends Annotation> annotationType, Configuration configuration) {
return classesShouldNotBeAnnotatedWith(regex, annotationType.getName(), configuration);
}

public JavaConfigurer classesShouldNotBeAnnotatedWith(String regex, String annotationType) {
return classesShouldNotBeAnnotatedWith(regex, annotationType, defaultConfiguration());
}
Expand All @@ -215,6 +243,13 @@ public JavaConfigurer classesAnnotatedWithShouldResideInPackage(
defaultConfiguration());
}

public JavaConfigurer classesAnnotatedWithShouldResideInPackage(
Class<? extends Annotation> annotationType, String packageIdentifier,
Configuration configuration) {
return classesAnnotatedWithShouldResideInPackage(annotationType.getName(), packageIdentifier,
configuration);
}

public JavaConfigurer classesAnnotatedWithShouldResideInPackage(
String annotationType, String packageIdentifier) {
return classesAnnotatedWithShouldResideInPackage(annotationType, packageIdentifier,
Expand Down Expand Up @@ -243,6 +278,11 @@ public JavaConfigurer classesShouldBeAssignableTo(String regex, Class<?> clazz)
return classesShouldBeAssignableTo(regex, clazz.getName(), defaultConfiguration());
}

public JavaConfigurer classesShouldBeAssignableTo(String regex, Class<?> clazz,
Configuration configuration) {
return classesShouldBeAssignableTo(regex, clazz.getName(), configuration);
}

public JavaConfigurer classesShouldBeAssignableTo(String regex, String typeName) {
return classesShouldBeAssignableTo(regex, typeName, defaultConfiguration());
}
Expand All @@ -260,6 +300,11 @@ public JavaConfigurer classesShouldImplement(String regex, Class<?> clazz) {
return classesShouldImplement(regex, clazz.getName(), defaultConfiguration());
}

public JavaConfigurer classesShouldImplement(String regex, Class<?> clazz,
Configuration configuration) {
return classesShouldImplement(regex, clazz.getName(), configuration);
}

public JavaConfigurer classesShouldImplement(String regex, String typeName) {
return classesShouldImplement(regex, typeName, defaultConfiguration());
}
Expand Down Expand Up @@ -290,6 +335,11 @@ public JavaConfigurer noUsageOf(Class<?> clazz, String packageIdentifier) {
return noUsageOf(clazz.getName(), packageIdentifier, defaultConfiguration());
}

public JavaConfigurer noUsageOf(Class<?> clazz, String packageIdentifier,
Configuration configuration) {
return noUsageOf(clazz.getName(), packageIdentifier, configuration);
}

public JavaConfigurer noUsageOf(Class<?> clazz, Configuration configuration) {
return noUsageOf(clazz.getName(), null, configuration);
}
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/enofex/taikai/java/NamingConfigurer.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public NamingConfigurer methodsAnnotatedWithShouldMatch(
return methodsAnnotatedWithShouldMatch(annotationType.getName(), regex, defaultConfiguration());
}

public NamingConfigurer methodsAnnotatedWithShouldMatch(
Class<? extends Annotation> annotationType, String regex, Configuration configuration) {
return methodsAnnotatedWithShouldMatch(annotationType.getName(), regex, configuration);
}

public NamingConfigurer methodsAnnotatedWithShouldMatch(
String annotationType, String regex) {
return methodsAnnotatedWithShouldMatch(annotationType, regex, defaultConfiguration());
Expand Down Expand Up @@ -93,6 +98,11 @@ public NamingConfigurer fieldsAnnotatedWithShouldMatch(
return fieldsAnnotatedWithShouldMatch(annotationType.getName(), regex, defaultConfiguration());
}

public NamingConfigurer fieldsAnnotatedWithShouldMatch(
Class<? extends Annotation> annotationType, String regex, Configuration configuration) {
return fieldsAnnotatedWithShouldMatch(annotationType.getName(), regex, configuration);
}

public NamingConfigurer fieldsAnnotatedWithShouldMatch(String annotationType, String regex) {
return fieldsAnnotatedWithShouldMatch(annotationType, regex, defaultConfiguration());
}
Expand All @@ -114,6 +124,11 @@ public NamingConfigurer fieldsShouldMatch(Class<?> clazz, String regex) {
return fieldsShouldMatch(clazz.getName(), regex, defaultConfiguration());
}

public NamingConfigurer fieldsShouldMatch(Class<?> clazz, String regex,
Configuration configuration) {
return fieldsShouldMatch(clazz.getName(), regex, configuration);
}

public NamingConfigurer fieldsShouldMatch(String typeName, String regex,
Configuration configuration) {
return addRule(TaikaiRule.of(fields()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public LoggingConfigurer classesShouldUseLogger(Class<?> clazz, String regex) {
return classesShouldUseLogger(clazz.getName(), regex, defaultConfiguration());
}

public LoggingConfigurer classesShouldUseLogger(Class<?> clazz, String regex,
Configuration configuration) {
return classesShouldUseLogger(clazz.getName(), regex, configuration);
}

public LoggingConfigurer classesShouldUseLogger(String typeName, String regex,
Configuration configuration) {
return addRule(TaikaiRule.of(classes()
Expand Down
Loading

0 comments on commit f03a3f5

Please sign in to comment.