Skip to content

Commit d3e23bc

Browse files
committed
Update for ArchUnit breaking changes
1 parent 06e7d69 commit d3e23bc

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/test/java/org/kohsuke/github/ArchTests.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
import java.lang.reflect.Field;
2626
import java.nio.charset.Charset;
2727
import java.util.Arrays;
28+
import java.util.stream.Collectors;
2829

2930
import static com.google.common.base.Preconditions.checkNotNull;
3031
import static com.tngtech.archunit.core.domain.JavaCall.Predicates.target;
3132
import static com.tngtech.archunit.core.domain.JavaClass.Predicates.resideInAPackage;
3233
import static com.tngtech.archunit.core.domain.JavaClass.Predicates.type;
33-
import static com.tngtech.archunit.core.domain.JavaClass.namesOf;
3434
import static com.tngtech.archunit.core.domain.properties.HasName.Predicates.name;
3535
import static com.tngtech.archunit.core.domain.properties.HasName.Predicates.nameContaining;
3636
import static com.tngtech.archunit.core.domain.properties.HasOwner.Predicates.With.owner;
@@ -61,7 +61,7 @@ public class ArchTests {
6161
"preview has no required media types defined") {
6262

6363
@Override
64-
public boolean apply(JavaAnnotation<?> javaAnnotation) {
64+
public boolean test(JavaAnnotation<?> javaAnnotation) {
6565
boolean isPreview = javaAnnotation.getRawType().isEquivalentTo(Preview.class);
6666
Object[] values = (Object[]) javaAnnotation.getProperties().get("value");
6767
return isPreview && values != null && values.length < 1;
@@ -194,7 +194,11 @@ public static DescribedPredicate<JavaCall<?>> targetMethodIs(Class<?> owner,
194194
.and(JavaCall.Predicates.target(name(methodName)))
195195
.and(JavaCall.Predicates.target(rawParameterTypes(parameterTypes)))
196196
.as("method is %s",
197-
Formatters.formatMethodSimple(owner.getSimpleName(), methodName, namesOf(parameterTypes)));
197+
Formatters.formatMethodSimple(owner.getSimpleName(),
198+
methodName,
199+
Arrays.stream(parameterTypes)
200+
.map(item -> item.getName())
201+
.collect(Collectors.toList())));
198202
}
199203

200204
/**
@@ -224,8 +228,8 @@ private static class UnlessPredicate<T> extends DescribedPredicate<T> {
224228
}
225229

226230
@Override
227-
public boolean apply(T input) {
228-
return current.apply(input) && !other.apply(input);
231+
public boolean test(T input) {
232+
return current.test(input) && !other.test(input);
229233
}
230234
}
231235
}

0 commit comments

Comments
 (0)