Polishing

This commit is contained in:
Sam Brannen
2022-08-17 12:03:10 +02:00
parent 06d9db154e
commit ef7ab768e7
5 changed files with 9 additions and 21 deletions

View File

@@ -200,7 +200,7 @@ class TestExecutionListenersTests {
}
private List<String> names(List<Class<?>> classes) {
return classes.stream().map(Class::getSimpleName).collect(toList());
return classes.stream().map(Class::getSimpleName).toList();
}
private void assertRegisteredListeners(Class<?> testClass, List<Class<?>> expected) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@ import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.util.ReflectionTestUtils;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.Mockito.mock;
@@ -166,7 +165,7 @@ class LruContextCacheTests {
List<String> actualNames = contextMap.keySet().stream()
.map(cfg -> cfg.getClasses()[0])
.map(Class::getSimpleName)
.collect(toList());
.toList();
// @formatter:on
assertThat(actualNames).isEqualTo(asList(expectedNames));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.test.context.event.ApplicationEventsHolder;
@@ -51,7 +50,7 @@ class DefaultPublishedEvents implements PublishedEvents {
}
static <T> SimpleTypedPublishedEvents<T> of(Stream<T> stream) {
return new SimpleTypedPublishedEvents<>(stream.collect(Collectors.toList()));
return new SimpleTypedPublishedEvents<>(stream.toList());
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.springframework.test.context.junit.jupiter.event;
import java.util.Arrays;
import java.util.function.Function;
import java.util.function.Predicate;
@@ -30,16 +29,6 @@ import java.util.function.Predicate;
*/
public interface PublishedEvents {
/**
* Creates a new {@link PublishedEvents} instance for the given events.
*
* @param events must not be {@literal null}
* @return will never be {@literal null}
*/
public static PublishedEvents of(Object... events) {
return of(Arrays.asList(events));
}
/**
* Returns all application events of the given type that were fired during the test execution.
*