Browse Source

Merge pull request #15084 from dreis2211

* pr/15084:
  Remove unused static methods in tests
pull/15097/head
Stephane Nicoll 7 years ago
parent
commit
804f647a34
  1. 10
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java
  2. 12
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java

10
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java

@ -16,8 +16,6 @@ @@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.jdbc;
import java.lang.reflect.Field;
import javax.sql.DataSource;
import com.zaxxer.hikari.HikariDataSource;
@ -25,7 +23,6 @@ import org.junit.Test; @@ -25,7 +23,6 @@ import org.junit.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;
@ -105,11 +102,4 @@ public class HikariDataSourceConfigurationTests { @@ -105,11 +102,4 @@ public class HikariDataSourceConfigurationTests {
});
}
@SuppressWarnings("unchecked")
public static <T> T getField(Class<?> target, String name) {
Field field = ReflectionUtils.findField(target, name, null);
ReflectionUtils.makeAccessible(field);
return (T) ReflectionUtils.getField(field, target);
}
}

12
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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,8 +16,6 @@ @@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.jdbc;
import java.lang.reflect.Field;
import javax.sql.DataSource;
import org.apache.tomcat.jdbc.pool.DataSourceProxy;
@ -34,7 +32,6 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext @@ -34,7 +32,6 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableMBeanExport;
import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
@ -115,13 +112,6 @@ public class TomcatDataSourceConfigurationTests { @@ -115,13 +112,6 @@ public class TomcatDataSourceConfigurationTests {
assertThat(ds.getValidationInterval()).isEqualTo(3000L);
}
@SuppressWarnings("unchecked")
public static <T> T getField(Class<?> target, String name) {
Field field = ReflectionUtils.findField(target, name, null);
ReflectionUtils.makeAccessible(field);
return (T) ReflectionUtils.getField(field, target);
}
@Configuration
@EnableConfigurationProperties
@EnableMBeanExport

Loading…
Cancel
Save