Suppress warnings from tests in Gradle build

This commit is contained in:
Sam Brannen
2019-02-01 11:13:53 +01:00
parent 5e7065d829
commit 0742986e0e
3 changed files with 14 additions and 4 deletions

View File

@@ -49,15 +49,17 @@ import static org.junit.Assert.*;
public class MethodValidationTests {
@Test
@SuppressWarnings("unchecked")
public void testMethodValidationInterceptor() {
MyValidBean bean = new MyValidBean();
ProxyFactory proxyFactory = new ProxyFactory(bean);
proxyFactory.addAdvice(new MethodValidationInterceptor());
proxyFactory.addAdvisor(new AsyncAnnotationAdvisor());
doTestProxyValidation((MyValidInterface) proxyFactory.getProxy());
doTestProxyValidation((MyValidInterface<String>) proxyFactory.getProxy());
}
@Test
@SuppressWarnings("unchecked")
public void testMethodValidationPostProcessor() {
StaticApplicationContext ac = new StaticApplicationContext();
ac.registerSingleton("mvpp", MethodValidationPostProcessor.class);
@@ -70,7 +72,7 @@ public class MethodValidationTests {
ac.close();
}
private void doTestProxyValidation(MyValidInterface proxy) {
private void doTestProxyValidation(MyValidInterface<String> proxy) {
assertNotNull(proxy.myValidMethod("value", 5));
try {
assertNotNull(proxy.myValidMethod("value", 15));
@@ -122,6 +124,7 @@ public class MethodValidationTests {
@Test
public void testLazyValidatorForMethodValidation() {
@SuppressWarnings("resource")
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
LazyMethodValidationConfig.class, CustomValidatorBean.class,
MyValidBean.class, MyValidFactoryBean.class);
@@ -130,6 +133,7 @@ public class MethodValidationTests {
@Test
public void testLazyValidatorForMethodValidationWithProxyTargetClass() {
@SuppressWarnings("resource")
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
LazyMethodValidationConfigWithProxyTargetClass.class, CustomValidatorBean.class,
MyValidBean.class, MyValidFactoryBean.class);