Skip to content

Commit

Permalink
Merge pull request #27736 from izeye
Browse files Browse the repository at this point in the history
* gh-27736:
  Polish "Polish access modifiers for test classes"
  Polish access modifiers for test classes

Closes gh-27736
  • Loading branch information
wilkinsona committed Aug 18, 2021
2 parents 2baee89 + ffbd28b commit ea9f851
Show file tree
Hide file tree
Showing 61 changed files with 193 additions and 121 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand Down Expand Up @@ -27,7 +27,7 @@
*
* @author Andy Wilkinson
*/
public class ArtifactoryRepositoryTests {
class ArtifactoryRepositoryTests {

@Test
void whenProjectVersionIsMilestoneThenRepositoryIsMilestone() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
*
* @author Andy Wilkinson
*/
public class BomPluginIntegrationTests {
class BomPluginIntegrationTests {

private File projectDir;

private File buildFile;

@BeforeEach
public void setup(@TempDir File projectDir) throws IOException {
void setup(@TempDir File projectDir) throws IOException {
this.projectDir = projectDir;
this.buildFile = new File(this.projectDir, "build.gradle");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand All @@ -25,7 +25,7 @@
*
* @author Andy Wilkinson
*/
public class ArtifactVersionDependencyVersionTests {
class ArtifactVersionDependencyVersionTests {

@Test
void parseWhenVersionIsNotAMavenVersionShouldReturnNull() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand All @@ -25,7 +25,7 @@
*
* @author Andy Wilkinson
*/
public class CalendarVersionDependencyVersionTests {
class CalendarVersionDependencyVersionTests {

@Test
void parseWhenVersionIsNotACalendarVersionShouldReturnNull() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand All @@ -25,7 +25,7 @@
*
* @author Andy Wilkinson
*/
public class DependencyVersionTests {
class DependencyVersionTests {

@Test
void parseWhenValidMavenVersionShouldReturnArtifactVersionDependencyVersion() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand All @@ -25,7 +25,7 @@
*
* @author Andy Wilkinson
*/
public class NumericQualifierDependencyVersionTests {
class NumericQualifierDependencyVersionTests {

@Test
void isNewerThanOnVersionWithNumericQualifierWhenInputHasNoQualifierShouldReturnTrue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* @author Andy Wilkinson
*/
public class ReleaseTrainDependencyVersionTests {
class ReleaseTrainDependencyVersionTests {

@Test
void parsingOfANonReleaseTrainVersionReturnsNull() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand All @@ -25,7 +25,7 @@
*
* @author Brian Clozel
*/
public class CompoundConfigurationTableEntryTests {
class CompoundConfigurationTableEntryTests {

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand All @@ -25,7 +25,7 @@
*
* @author Brian Clozel
*/
public class ConfigurationTableTests {
class ConfigurationTableTests {

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand All @@ -25,7 +25,7 @@
*
* @author Brian Clozel
*/
public class SingleConfigurationTableEntryTests {
class SingleConfigurationTableEntryTests {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*
* @author Andy Wilkinson
*/
public class ReproduciblePluginsDatActionTests {
class ReproduciblePluginsDatActionTests {

@Test
void postProcessingOrdersCategoriesAndPlugins() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand Down Expand Up @@ -33,7 +33,7 @@
* @author Andy Wilkinson
* @author Mike Smithson
*/
public class PluginXmlParserTests {
class PluginXmlParserTests {

private final PluginXmlParser parser = new PluginXmlParser();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand Down Expand Up @@ -34,14 +34,14 @@
*
* @author Andy Wilkinson
*/
public class OptionalDependenciesPluginIntegrationTests {
class OptionalDependenciesPluginIntegrationTests {

private File projectDir;

private File buildFile;

@BeforeEach
public void setup(@TempDir File projectDir) throws IOException {
void setup(@TempDir File projectDir) throws IOException {
this.projectDir = projectDir;
this.buildFile = new File(this.projectDir, "build.gradle");
}
Expand Down Expand Up @@ -80,7 +80,7 @@ void optionalDependenciesAreAddedToTestSourceSetsRuntimeClasspath() throws IOExc
optionalDependenciesAreAddedToSourceSetClasspath("test", "runtimeClasspath");
}

public void optionalDependenciesAreAddedToSourceSetClasspath(String sourceSet, String classpath)
private void optionalDependenciesAreAddedToSourceSetClasspath(String sourceSet, String classpath)
throws IOException {
try (PrintWriter out = new PrintWriter(new FileWriter(this.buildFile))) {
out.println("plugins {");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand Down Expand Up @@ -39,7 +39,7 @@
*
* @author Andy Wilkinson
*/
public class DefaultWebMvcTagsProviderTests {
class DefaultWebMvcTagsProviderTests {

@Test
void whenTagsAreProvidedThenDefaultTagsArePresent() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
Expand All @@ -25,7 +25,7 @@
*
* @author Andy Wilkinson
*/
public class OutcomeTests {
class OutcomeTests {

@Test
void outcomeForInformationalStatusIsInformational() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand Down Expand Up @@ -37,7 +37,7 @@
*
* @author Andy Wilkinson
*/
public class DefaultWebFluxTagsProviderTests {
class DefaultWebFluxTagsProviderTests {

@Test
void whenTagsAreProvidedThenDefaultTagsArePresent() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand Down Expand Up @@ -35,7 +35,7 @@
* @author Oliver Gierke
*/
@SuppressWarnings("resource")
public class AutoConfigurationPackagesTests {
class AutoConfigurationPackagesTests {

@Test
void setAndGet() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand Down Expand Up @@ -31,6 +31,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.boot.autoconfigure.condition.scan.ScanBean;
import org.springframework.boot.autoconfigure.condition.scan.ScannedFactoryBeanConfiguration;
import org.springframework.boot.autoconfigure.condition.scan.ScannedFactoryBeanWithBeanMethodArgumentsConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
Expand Down Expand Up @@ -60,7 +61,7 @@
* @author Andy Wilkinson
*/
@SuppressWarnings("resource")
public class ConditionalOnMissingBeanTests {
class ConditionalOnMissingBeanTests {

private final ApplicationContextRunner contextRunner = new ApplicationContextRunner();

Expand Down Expand Up @@ -161,15 +162,15 @@ void testOnMissingBeanConditionWithComponentScannedFactoryBean() {
this.contextRunner
.withUserConfiguration(ComponentScannedFactoryBeanBeanMethodConfiguration.class,
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
.run((context) -> assertThat(context.getBean(ScanBean.class).toString()).isEqualTo("fromFactory"));
}

@Test
void testOnMissingBeanConditionWithComponentScannedFactoryBeanWithBeanMethodArguments() {
this.contextRunner
.withUserConfiguration(ComponentScannedFactoryBeanBeanMethodWithArgumentsConfiguration.class,
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
.run((context) -> assertThat(context.getBean(ScanBean.class).toString()).isEqualTo("fromFactory"));
}

@Test
Expand Down Expand Up @@ -617,9 +618,9 @@ ExampleBean exampleBean2() {

}

public static class ExampleFactoryBean implements FactoryBean<ExampleBean> {
static class ExampleFactoryBean implements FactoryBean<ExampleBean> {

public ExampleFactoryBean(String value) {
ExampleFactoryBean(String value) {
Assert.state(!value.contains("$"), "value should not contain '$'");
}

Expand Down Expand Up @@ -738,11 +739,11 @@ TestParameterizedContainer<CustomExampleBean> conditionalCustomExampleBean() {
}

@TestAnnotation
public static class ExampleBean {
static class ExampleBean {

private String value;

public ExampleBean(String value) {
ExampleBean(String value) {
this.value = value;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2012-2021 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.boot.autoconfigure.condition.scan;

public class ScanBean {

private String value;

public ScanBean(String value) {
this.value = value;
}

@Override
public String toString() {
return this.value;
}

}

0 comments on commit ea9f851

Please sign in to comment.