Reformat code following spring-javaformat upgrade

This commit is contained in:
Phillip Webb
2023-02-21 22:49:23 -08:00
parent b93c9f7fec
commit df5898a146
1878 changed files with 27649 additions and 22403 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -96,7 +96,8 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
candidates.add(testMethod);
candidates.addAll(getAnnotatedElements(arguments.toArray()));
List<AnnotatedElement> annotatedElements = candidates.stream()
.filter(ModifiedClassPathClassLoader::hasAnnotation).collect(Collectors.toList());
.filter(ModifiedClassPathClassLoader::hasAnnotation)
.collect(Collectors.toList());
if (annotatedElements.isEmpty()) {
return null;
}
@@ -126,8 +127,8 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
private static ModifiedClassPathClassLoader compute(ClassLoader classLoader,
List<AnnotatedElement> annotatedClasses) {
List<MergedAnnotations> annotations = annotatedClasses.stream()
.map((source) -> MergedAnnotations.from(source, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY))
.collect(Collectors.toList());
.map((source) -> MergedAnnotations.from(source, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY))
.collect(Collectors.toList());
return new ModifiedClassPathClassLoader(processUrls(extractUrls(classLoader), annotations),
classLoader.getParent(), classLoader);
}
@@ -150,7 +151,7 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
return Stream.of(((URLClassLoader) classLoader).getURLs());
}
return Stream.of(ManagementFactory.getRuntimeMXBean().getClassPath().split(File.pathSeparator))
.map(ModifiedClassPathClassLoader::toURL);
.map(ModifiedClassPathClassLoader::toURL);
}
private static URL toURL(String entry) {
@@ -237,7 +238,8 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository localRepository = new LocalRepository(System.getProperty("user.home") + "/.m2/repository");
RemoteRepository remoteRepository = new RemoteRepository.Builder("central", "default",
"https://repo.maven.apache.org/maven2").build();
"https://repo.maven.apache.org/maven2")
.build();
session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(session, localRepository));
for (int i = 0; i < MAX_RESOLUTION_ATTEMPTS; i++) {
CollectRequest collectRequest = new CollectRequest(null, Arrays.asList(remoteRepository));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -109,7 +109,8 @@ class ModifiedClassPathExtension implements InvocationInterceptor {
private void runTest(String testId) throws Throwable {
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
.selectors(DiscoverySelectors.selectUniqueId(testId)).build();
.selectors(DiscoverySelectors.selectUniqueId(testId))
.build();
Launcher launcher = LauncherFactory.create();
TestPlan testPlan = launcher.discover(request);
SummaryGeneratingListener listener = new SummaryGeneratingListener();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -54,7 +54,7 @@ class DisabledOnOsCondition implements ExecutionCondition {
}
}
return ConditionEvaluationResult
.enabled(String.format("Enabled on OS = %s, architecture = %s", os, architecture));
.enabled(String.format("Enabled on OS = %s, architecture = %s", os, architecture));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 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.
@@ -87,9 +87,10 @@ public abstract class MockServletWebServer {
return null;
}).when(this.servletContext).setInitParameter(anyString(), anyString());
given(this.servletContext.getInitParameterNames())
.willReturn(Collections.enumeration(initParameters.keySet()));
lenient().doAnswer((invocation) -> initParameters.get(invocation.getArgument(0))).when(this.servletContext)
.getInitParameter(anyString());
.willReturn(Collections.enumeration(initParameters.keySet()));
lenient().doAnswer((invocation) -> initParameters.get(invocation.getArgument(0)))
.when(this.servletContext)
.getInitParameter(anyString());
given(this.servletContext.getAttributeNames()).willReturn(Collections.emptyEnumeration());
for (Initializer initializer : this.initializers) {
initializer.onStartup(this.servletContext);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -39,7 +39,7 @@ class ModifiedClassPathExtensionOverridesParameterizedTests {
@MethodSource("parameter")
void classesAreLoadedFromParameter(Class<?> type) {
assertThat(ApplicationContext.class.getProtectionDomain().getCodeSource().getLocation().toString())
.endsWith("spring-context-4.1.0.RELEASE.jar");
.endsWith("spring-context-4.1.0.RELEASE.jar");
}
static Class<?>[] parameter() {
@@ -51,7 +51,7 @@ class ModifiedClassPathExtensionOverridesParameterizedTests {
@MethodSource("arrayParameter")
void classesAreLoadedFromParameterInArray(Object[] types) {
assertThat(ApplicationContext.class.getProtectionDomain().getCodeSource().getLocation().toString())
.endsWith("spring-context-4.1.0.RELEASE.jar");
.endsWith("spring-context-4.1.0.RELEASE.jar");
}
static Stream<Arguments> arrayParameter() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 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.
@@ -34,13 +34,13 @@ class ModifiedClassPathExtensionOverridesTests {
@Test
void classesAreLoadedFromOverride() {
assertThat(ApplicationContext.class.getProtectionDomain().getCodeSource().getLocation().toString())
.endsWith("spring-context-4.1.0.RELEASE.jar");
.endsWith("spring-context-4.1.0.RELEASE.jar");
}
@Test
void classesAreLoadedFromTransitiveDependencyOfOverride() {
assertThat(StringUtils.class.getProtectionDomain().getCodeSource().getLocation().toString())
.endsWith("spring-core-4.1.0.RELEASE.jar");
.endsWith("spring-core-4.1.0.RELEASE.jar");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 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.
@@ -39,7 +39,7 @@ class MockServletWebServerTests {
void servletContextHasSessionCookieConfigConfigured() {
MockServletWebServer server = TestMockServletWebServer.create();
assertThat(server.getServletContext().getSessionCookieConfig()).isNotNull()
.isInstanceOf(MockSessionCookieConfig.class);
.isInstanceOf(MockSessionCookieConfig.class);
}
private static final class TestMockServletWebServer extends MockServletWebServer {