Skip to content

Commit ea9f851

Browse files
committed
Merge pull request #27736 from izeye
* gh-27736: Polish "Polish access modifiers for test classes" Polish access modifiers for test classes Closes gh-27736
2 parents 2baee89 + ffbd28b commit ea9f851

File tree

61 files changed

+193
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+193
-121
lines changed

buildSrc/src/test/java/org/springframework/boot/build/artifactory/ArtifactoryRepositoryTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
2727
*
2828
* @author Andy Wilkinson
2929
*/
30-
public class ArtifactoryRepositoryTests {
30+
class ArtifactoryRepositoryTests {
3131

3232
@Test
3333
void whenProjectVersionIsMilestoneThenRepositoryIsMilestone() {

buildSrc/src/test/java/org/springframework/boot/build/bom/BomPluginIntegrationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
*
3939
* @author Andy Wilkinson
4040
*/
41-
public class BomPluginIntegrationTests {
41+
class BomPluginIntegrationTests {
4242

4343
private File projectDir;
4444

4545
private File buildFile;
4646

4747
@BeforeEach
48-
public void setup(@TempDir File projectDir) throws IOException {
48+
void setup(@TempDir File projectDir) throws IOException {
4949
this.projectDir = projectDir;
5050
this.buildFile = new File(this.projectDir, "build.gradle");
5151
}

buildSrc/src/test/java/org/springframework/boot/build/bom/bomr/version/ArtifactVersionDependencyVersionTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
*
2626
* @author Andy Wilkinson
2727
*/
28-
public class ArtifactVersionDependencyVersionTests {
28+
class ArtifactVersionDependencyVersionTests {
2929

3030
@Test
3131
void parseWhenVersionIsNotAMavenVersionShouldReturnNull() {

buildSrc/src/test/java/org/springframework/boot/build/bom/bomr/version/CalendarVersionDependencyVersionTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
*
2626
* @author Andy Wilkinson
2727
*/
28-
public class CalendarVersionDependencyVersionTests {
28+
class CalendarVersionDependencyVersionTests {
2929

3030
@Test
3131
void parseWhenVersionIsNotACalendarVersionShouldReturnNull() {

buildSrc/src/test/java/org/springframework/boot/build/bom/bomr/version/DependencyVersionTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
*
2626
* @author Andy Wilkinson
2727
*/
28-
public class DependencyVersionTests {
28+
class DependencyVersionTests {
2929

3030
@Test
3131
void parseWhenValidMavenVersionShouldReturnArtifactVersionDependencyVersion() {

buildSrc/src/test/java/org/springframework/boot/build/bom/bomr/version/NumericQualifierDependencyVersionTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
*
2626
* @author Andy Wilkinson
2727
*/
28-
public class NumericQualifierDependencyVersionTests {
28+
class NumericQualifierDependencyVersionTests {
2929

3030
@Test
3131
void isNewerThanOnVersionWithNumericQualifierWhenInputHasNoQualifierShouldReturnTrue() {

buildSrc/src/test/java/org/springframework/boot/build/bom/bomr/version/ReleaseTrainDependencyVersionTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
* @author Andy Wilkinson
2727
*/
28-
public class ReleaseTrainDependencyVersionTests {
28+
class ReleaseTrainDependencyVersionTests {
2929

3030
@Test
3131
void parsingOfANonReleaseTrainVersionReturnsNull() {

buildSrc/src/test/java/org/springframework/boot/build/context/properties/CompoundConfigurationTableEntryTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
*
2626
* @author Brian Clozel
2727
*/
28-
public class CompoundConfigurationTableEntryTests {
28+
class CompoundConfigurationTableEntryTests {
2929

3030
private static final String NEWLINE = System.lineSeparator();
3131

buildSrc/src/test/java/org/springframework/boot/build/context/properties/ConfigurationTableTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
*
2626
* @author Brian Clozel
2727
*/
28-
public class ConfigurationTableTests {
28+
class ConfigurationTableTests {
2929

3030
private static final String NEWLINE = System.lineSeparator();
3131

buildSrc/src/test/java/org/springframework/boot/build/context/properties/SingleConfigurationTableEntryTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
*
2626
* @author Brian Clozel
2727
*/
28-
public class SingleConfigurationTableEntryTests {
28+
class SingleConfigurationTableEntryTests {
2929

3030
private static final String NEWLINE = System.lineSeparator();
3131

buildSrc/src/test/java/org/springframework/boot/build/log4j2/ReproduciblePluginsDatActionTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
* @author Andy Wilkinson
3939
*/
40-
public class ReproduciblePluginsDatActionTests {
40+
class ReproduciblePluginsDatActionTests {
4141

4242
@Test
4343
void postProcessingOrdersCategoriesAndPlugins() throws IOException {

buildSrc/src/test/java/org/springframework/boot/build/mavenplugin/PluginXmlParserTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@
3333
* @author Andy Wilkinson
3434
* @author Mike Smithson
3535
*/
36-
public class PluginXmlParserTests {
36+
class PluginXmlParserTests {
3737

3838
private final PluginXmlParser parser = new PluginXmlParser();
3939

buildSrc/src/test/java/org/springframework/boot/build/optional/OptionalDependenciesPluginIntegrationTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,14 +34,14 @@
3434
*
3535
* @author Andy Wilkinson
3636
*/
37-
public class OptionalDependenciesPluginIntegrationTests {
37+
class OptionalDependenciesPluginIntegrationTests {
3838

3939
private File projectDir;
4040

4141
private File buildFile;
4242

4343
@BeforeEach
44-
public void setup(@TempDir File projectDir) throws IOException {
44+
void setup(@TempDir File projectDir) throws IOException {
4545
this.projectDir = projectDir;
4646
this.buildFile = new File(this.projectDir, "build.gradle");
4747
}
@@ -80,7 +80,7 @@ void optionalDependenciesAreAddedToTestSourceSetsRuntimeClasspath() throws IOExc
8080
optionalDependenciesAreAddedToSourceSetClasspath("test", "runtimeClasspath");
8181
}
8282

83-
public void optionalDependenciesAreAddedToSourceSetClasspath(String sourceSet, String classpath)
83+
private void optionalDependenciesAreAddedToSourceSetClasspath(String sourceSet, String classpath)
8484
throws IOException {
8585
try (PrintWriter out = new PrintWriter(new FileWriter(this.buildFile))) {
8686
out.println("plugins {");

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/DefaultWebMvcTagsProviderTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@
3939
*
4040
* @author Andy Wilkinson
4141
*/
42-
public class DefaultWebMvcTagsProviderTests {
42+
class DefaultWebMvcTagsProviderTests {
4343

4444
@Test
4545
void whenTagsAreProvidedThenDefaultTagsArePresent() {

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/http/OutcomeTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
*
2626
* @author Andy Wilkinson
2727
*/
28-
public class OutcomeTests {
28+
class OutcomeTests {
2929

3030
@Test
3131
void outcomeForInformationalStatusIsInformational() {

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/DefaultWebFluxTagsProviderTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@
3737
*
3838
* @author Andy Wilkinson
3939
*/
40-
public class DefaultWebFluxTagsProviderTests {
40+
class DefaultWebFluxTagsProviderTests {
4141

4242
@Test
4343
void whenTagsAreProvidedThenDefaultTagsArePresent() {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
3535
* @author Oliver Gierke
3636
*/
3737
@SuppressWarnings("resource")
38-
public class AutoConfigurationPackagesTests {
38+
class AutoConfigurationPackagesTests {
3939

4040
@Test
4141
void setAndGet() {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
3131
import org.springframework.beans.factory.annotation.Value;
3232
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
3333
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
34+
import org.springframework.boot.autoconfigure.condition.scan.ScanBean;
3435
import org.springframework.boot.autoconfigure.condition.scan.ScannedFactoryBeanConfiguration;
3536
import org.springframework.boot.autoconfigure.condition.scan.ScannedFactoryBeanWithBeanMethodArgumentsConfiguration;
3637
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
@@ -60,7 +61,7 @@
6061
* @author Andy Wilkinson
6162
*/
6263
@SuppressWarnings("resource")
63-
public class ConditionalOnMissingBeanTests {
64+
class ConditionalOnMissingBeanTests {
6465

6566
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner();
6667

@@ -161,15 +162,15 @@ void testOnMissingBeanConditionWithComponentScannedFactoryBean() {
161162
this.contextRunner
162163
.withUserConfiguration(ComponentScannedFactoryBeanBeanMethodConfiguration.class,
163164
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
164-
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
165+
.run((context) -> assertThat(context.getBean(ScanBean.class).toString()).isEqualTo("fromFactory"));
165166
}
166167

167168
@Test
168169
void testOnMissingBeanConditionWithComponentScannedFactoryBeanWithBeanMethodArguments() {
169170
this.contextRunner
170171
.withUserConfiguration(ComponentScannedFactoryBeanBeanMethodWithArgumentsConfiguration.class,
171172
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
172-
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
173+
.run((context) -> assertThat(context.getBean(ScanBean.class).toString()).isEqualTo("fromFactory"));
173174
}
174175

175176
@Test
@@ -617,9 +618,9 @@ ExampleBean exampleBean2() {
617618

618619
}
619620

620-
public static class ExampleFactoryBean implements FactoryBean<ExampleBean> {
621+
static class ExampleFactoryBean implements FactoryBean<ExampleBean> {
621622

622-
public ExampleFactoryBean(String value) {
623+
ExampleFactoryBean(String value) {
623624
Assert.state(!value.contains("$"), "value should not contain '$'");
624625
}
625626

@@ -738,11 +739,11 @@ TestParameterizedContainer<CustomExampleBean> conditionalCustomExampleBean() {
738739
}
739740

740741
@TestAnnotation
741-
public static class ExampleBean {
742+
static class ExampleBean {
742743

743744
private String value;
744745

745-
public ExampleBean(String value) {
746+
ExampleBean(String value) {
746747
this.value = value;
747748
}
748749

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2012-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.autoconfigure.condition.scan;
18+
19+
public class ScanBean {
20+
21+
private String value;
22+
23+
public ScanBean(String value) {
24+
this.value = value;
25+
}
26+
27+
@Override
28+
public String toString() {
29+
return this.value;
30+
}
31+
32+
}

0 commit comments

Comments
 (0)