Remove unused static methods in tests

Closes gh-15084
pull/15097/head
dreis2211 6 years ago committed by Stephane Nicoll
parent 0bd69fded8
commit 5e35ac6ce5

@ -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;
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 {
});
}
@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);
}
}

@ -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 @@
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
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 {
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