diff --git a/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/AbstractContainerGroupAssert.java b/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/AbstractContainerGroupAssert.java index a44af6e3..6dd6e0a4 100644 --- a/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/AbstractContainerGroupAssert.java +++ b/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/AbstractContainerGroupAssert.java @@ -19,8 +19,8 @@ import static org.assertj.core.api.Assertions.assertThat; import io.github.ascopes.jct.containers.ContainerGroup; -import java.util.ArrayList; import java.util.List; +import java.util.ServiceLoader; import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractListAssert; import org.assertj.core.api.ObjectAssert; @@ -74,9 +74,9 @@ public LocationAssert location() { requireNonNull(type, "type must not be null"); isNotNull(); - var items = new ArrayList(); - actual.getServiceLoader(type).iterator().forEachRemaining(items::add); - + var items = actual.getServiceLoader(type) + .stream() + .map(ServiceLoader.Provider::get); return assertThat(items); } } diff --git a/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/TraceDiagnosticListAssert.java b/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/TraceDiagnosticListAssert.java index ab5e330a..2fa1aeaa 100644 --- a/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/TraceDiagnosticListAssert.java +++ b/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/TraceDiagnosticListAssert.java @@ -353,7 +353,8 @@ protected TraceDiagnosticListAssert newAbstractIterableAssert( } private Predicate<@Nullable TraceDiagnostic> kindIsOneOf( - Iterable kinds) { + Iterable kinds + ) { var kindsSet = new LinkedHashSet(); kinds.forEach(kindsSet::add); diff --git a/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/TypeAwareListAssert.java b/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/TypeAwareListAssert.java index 7a708825..72f82c12 100644 --- a/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/TypeAwareListAssert.java +++ b/java-compiler-testing/src/main/java/io/github/ascopes/jct/assertions/TypeAwareListAssert.java @@ -56,10 +56,7 @@ protected A toAssert(@Nullable E value, String description) { protected TypeAwareListAssert<@Nullable E, A> newAbstractIterableAssert( Iterable iterable ) { - var list = StreamSupport - .stream(iterable.spliterator(), false) - .toList(); - + var list = StreamSupport.stream(iterable.spliterator(), false).toList(); return new TypeAwareListAssert<>(list, assertFactory); } }