Skip to content

Polish #10948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Polish #10948

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public DataSource secondOne() {
}

private DataSource createDataSource() {
String url = "jdbc:hsqldb:mem:test-" + UUID.randomUUID().toString();
String url = "jdbc:hsqldb:mem:test-" + UUID.randomUUID();
return DataSourceBuilder.create().url(url).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ public SpringIntegrationMetrics(IntegrationManagementConfigurer configurer,

@Override
public void bindTo(MeterRegistry registry) {
registerGuage(registry, this.configurer, this.tags,
registerGauge(registry, this.configurer, this.tags,
"spring.integration.channelNames",
"The number of spring integration channels",
(configurer) -> configurer.getChannelNames().length);
registerGuage(registry, this.configurer, this.tags,
registerGauge(registry, this.configurer, this.tags,
"spring.integration.handlerNames",
"The number of spring integration handlers",
(configurer) -> configurer.getHandlerNames().length);
registerGuage(registry, this.configurer, this.tags,
registerGauge(registry, this.configurer, this.tags,
"spring.integration.sourceNames",
"The number of spring integration sources",
(configurer) -> configurer.getSourceNames().length);
Expand Down Expand Up @@ -105,7 +105,7 @@ private void addHandlerMetrics(MeterRegistry registry) {
registerTimedGauge(registry, handlerMetrics, tagsWithHandler,
"spring.integration.handler.duration.mean",
"The mean handler duration", MessageHandlerMetrics::getMeanDuration);
registerGuage(registry, handlerMetrics, tagsWithHandler,
registerGauge(registry, handlerMetrics, tagsWithHandler,
"spring.integration.handler.activeCount",
"The number of active handlers",
MessageHandlerMetrics::getActiveCount);
Expand Down Expand Up @@ -133,7 +133,7 @@ private void addChannelMetrics(MeterRegistry registry) {
}
}

private <T> void registerGuage(MeterRegistry registry, T object, Iterable<Tag> tags,
private <T> void registerGauge(MeterRegistry registry, T object, Iterable<Tag> tags,
String name, String description, ToDoubleFunction<T> value) {
Gauge.Builder<?> builder = Gauge.builder(name, object, value);
builder.tags(this.tags).description(description).register(registry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void statusMustNotBeNull() throws Exception {
public void createWithStatus() throws Exception {
Health health = Health.status(Status.UP).build();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}

@Test
Expand Down Expand Up @@ -100,7 +100,7 @@ public void unknownWithDetails() throws Exception {
public void unknown() throws Exception {
Health health = new Health.Builder().unknown().build();
assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}

@Test
Expand All @@ -114,7 +114,7 @@ public void upWithDetails() throws Exception {
public void up() throws Exception {
Health health = new Health.Builder().up().build();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}

@Test
Expand All @@ -130,28 +130,28 @@ public void downWithException() throws Exception {
public void down() throws Exception {
Health health = Health.down().build();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}

@Test
public void outOfService() throws Exception {
Health health = Health.outOfService().build();
assertThat(health.getStatus()).isEqualTo(Status.OUT_OF_SERVICE);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}

@Test
public void statusCode() throws Exception {
Health health = Health.status("UP").build();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}

@Test
public void status() throws Exception {
Health health = Health.status(Status.UP).build();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void extractOnlyInfoProperty() {
public void extractNoEntry() {
TestPropertyValues.of("foo=bar").applyTo(this.environment);
Info actual = contributeFrom(this.environment);
assertThat(actual.getDetails().size()).isEqualTo(0);
assertThat(actual.getDetails()).isEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

/**
* Tests for {@link WebMvcMetricsFilter}
* Tests for {@link WebMvcMetricsFilter}.
*
* @author Jon Schneider
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private boolean isDataSourceAutoCommitDisabled() {

private boolean runningOnWebSphere() {
return ClassUtils.isPresent(
"com.ibm.websphere.jtaextensions." + "ExtendedJTATransaction",
"com.ibm.websphere.jtaextensions.ExtendedJTATransaction",
getClass().getClassLoader());
}

Expand All @@ -175,7 +175,7 @@ private void configureSpringJtaPlatform(Map<String, Object> vendorProperties,
}
catch (LinkageError ex) {
// NoClassDefFoundError can happen if Hibernate 4.2 is used and some
// containers (e.g. JBoss EAP 6) wraps it in the superclass LinkageError
// containers (e.g. JBoss EAP 6) wrap it in the superclass LinkageError
if (!isUsingJndi()) {
throw new IllegalStateException("Unable to set Hibernate JTA "
+ "platform, are you using the correct "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import static org.junit.Assert.fail;

/**
* Tests for {@link DataSourceInitializer}.
* Tests for {@link DataSourceInitializerInvoker}.
*
* @author Dave Syer
* @author Stephane Nicoll
Expand All @@ -61,7 +61,7 @@ public class DataSourceInitializerInvokerTests {
.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class))
.withPropertyValues("spring.datasource.initialization-mode=never",
"spring.datasource.url:jdbc:hsqldb:mem:init-"
+ UUID.randomUUID().toString());
+ UUID.randomUUID());

@Test
public void dataSourceInitialized() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void initializeOnlyEmbeddedByDefault() throws SQLException {

private HikariDataSource createDataSource() {
return DataSourceBuilder.create().type(HikariDataSource.class)
.url("jdbc:h2:mem:" + UUID.randomUUID().toString()).build();
.url("jdbc:h2:mem:" + UUID.randomUUID()).build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void load(String... environment) {

private void load(Class<?> config, String... environment) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
String jdbcUrl = "jdbc:hsqldb:mem:test-" + UUID.randomUUID().toString();
String jdbcUrl = "jdbc:hsqldb:mem:test-" + UUID.randomUUID();
TestPropertyValues.of(environment).and("spring.datasource.url=" + jdbcUrl)
.applyTo(context);
if (config != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public DataSource secondDataSource() {
}

private DataSource createRandomDataSource() {
String url = "jdbc:h2:mem:init-" + UUID.randomUUID().toString();
String url = "jdbc:h2:mem:init-" + UUID.randomUUID();
return DataSourceBuilder.create().url(url).build();
}

Expand All @@ -275,7 +275,7 @@ public DataSource secondDataSource() {
}

private DataSource createRandomDataSource() {
String url = "jdbc:h2:mem:init-" + UUID.randomUUID().toString();
String url = "jdbc:h2:mem:init-" + UUID.randomUUID();
return DataSourceBuilder.create().url(url).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void noLocaleCharsetMapping() {
Map<String, WebServerFactoryCustomizer<?>> beans = getWebServerFactoryCustomizerBeans();
assertThat(beans.size()).isEqualTo(1);
assertThat(this.context.getBean(MockServletWebServerFactory.class)
.getLocaleCharsetMappings().size()).isEqualTo(0);
.getLocaleCharsetMappings()).isEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void resourceHandlerMappingDisabled() throws Exception {
.run((context) -> {
Map<String, List<Resource>> locations = getResourceMappingLocations(
context);
assertThat(locations.size()).isEqualTo(0);
assertThat(locations).isEmpty();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public void withTriggerFilter() throws Exception {
this.watcher.start();
FileCopyUtils.copy("abc".getBytes(), file);
Thread.sleep(100);
assertThat(this.changes.size()).isEqualTo(0);
assertThat(this.changes).isEmpty();
FileCopyUtils.copy("abc".getBytes(), trigger);
this.watcher.stopAfter(1);
ChangedFiles changedFiles = getSingleChangedFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public void folderUrl() throws Exception {
@Test
public void fileUrl() throws Exception {
URL url = this.temporaryFolder.newFile().toURI().toURL();
assertThat(ChangeableUrls.fromUrls(url).size()).isEqualTo(0);
assertThat(ChangeableUrls.fromUrls(url)).isEmpty();
}

@Test
public void httpUrl() throws Exception {
URL url = new URL("http://spring.io");
assertThat(ChangeableUrls.fromUrls(url).size()).isEqualTo(0);
assertThat(ChangeableUrls.fromUrls(url)).isEmpty();
}

@Test
Expand All @@ -69,7 +69,7 @@ public void skipsUrls() throws Exception {
makeUrl("spring-boot-autoconfigure"), makeUrl("spring-boot-actuator"),
makeUrl("spring-boot-starter"),
makeUrl("spring-boot-starter-some-thing"));
assertThat(urls.size()).isEqualTo(0);
assertThat(urls).isEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public void getResourcesWithDeleted() throws Exception {
String name = PACKAGE_PATH + "/Sample.txt";
this.updatedFiles.addFile(name, new ClassLoaderFile(Kind.DELETED, null));
List<URL> resources = toList(this.reloadClassLoader.getResources(name));
assertThat(resources.size()).isEqualTo(0);
assertThat(resources).isEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public abstract class AbstractApplicationContextRunnerTests<T extends AbstractAp

@Test
public void runWithSystemPropertiesShouldSetAndRemoveProperties() {
String key = "test." + UUID.randomUUID().toString();
String key = "test." + UUID.randomUUID();
assertThat(System.getProperties().containsKey(key)).isFalse();
get().withSystemProperties(key + "=value")
.run((context) -> assertThat(System.getProperties()).containsEntry(key,
Expand All @@ -63,7 +63,7 @@ public void runWithSystemPropertiesShouldSetAndRemoveProperties() {
@Test
public void runWithSystemPropertiesWhenContextFailsShouldRemoveProperties()
throws Exception {
String key = "test." + UUID.randomUUID().toString();
String key = "test." + UUID.randomUUID();
assertThat(System.getProperties().containsKey(key)).isFalse();
get().withSystemProperties(key + "=value")
.withUserConfiguration(FailingConfig.class)
Expand All @@ -74,7 +74,7 @@ public void runWithSystemPropertiesWhenContextFailsShouldRemoveProperties()
@Test
public void runWithSystemPropertiesShouldRestoreOriginalProperties()
throws Exception {
String key = "test." + UUID.randomUUID().toString();
String key = "test." + UUID.randomUUID();
System.setProperty(key, "value");
try {
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
Expand All @@ -91,7 +91,7 @@ public void runWithSystemPropertiesShouldRestoreOriginalProperties()
@Test
public void runWithSystemPropertiesWhenValueIsNullShouldRemoveProperty()
throws Exception {
String key = "test." + UUID.randomUUID().toString();
String key = "test." + UUID.randomUUID();
System.setProperty(key, "value");
try {
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public void close() throws Exception {
Field filesField = filePool.getClass().getDeclaredField("files");
filesField.setAccessible(true);
Queue<?> queue = (Queue<?>) filesField.get(filePool);
assertThat(queue.size()).isEqualTo(0);
assertThat(queue).isEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
* @author Phillip Webb
*/
public class BackCompatibiltyBinderIntegrationTests {
public class BackCompatibilityBinderIntegrationTests {

@Test
public void bindWhenBindingCamelCaseToEnvironmentWithExtractUnderscore()
Expand All @@ -49,7 +49,7 @@ public void bindWhenBindingCamelCaseToEnvironmentWithExtractUnderscore()
}

@Test
public void bindWhenUsingSystemEnvronmentToOverride() {
public void bindWhenUsingSystemEnvironmentToOverride() {
MockEnvironment environment = new MockEnvironment();
SystemEnvironmentPropertySource propertySource = new SystemEnvironmentPropertySource(
"override", Collections.singletonMap("foo.password", "test"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ class SpringApplicationExtensionsTests {
assertEquals(environment, context.environment)
}


@Configuration
internal open class ExampleConfig

@Configuration
internal open class ExampleWebConfig {

Expand Down