From 8af0151f1b207d70ca804610fdedc24733d7d89a Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 27 Aug 2015 17:57:50 +0200 Subject: [PATCH] Suppress recent deprecation warnings in tests --- .../springframework/util/Log4jConfigurerTests.java | 1 + .../jdbc/support/NativeJdbcExtractorTests.java | 10 +++++----- .../web/util/Log4jWebConfigurerTests.java | 12 +++++++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/spring-core/src/test/java/org/springframework/util/Log4jConfigurerTests.java b/spring-core/src/test/java/org/springframework/util/Log4jConfigurerTests.java index 52ec052d1b5..d26f3ea618c 100644 --- a/spring-core/src/test/java/org/springframework/util/Log4jConfigurerTests.java +++ b/spring-core/src/test/java/org/springframework/util/Log4jConfigurerTests.java @@ -30,6 +30,7 @@ import static org.junit.Assert.*; * @author Juergen Hoeller * @author Sam Brannen */ +@SuppressWarnings("deprecation") public class Log4jConfigurerTests { @Test diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java index fbefd477d09..0bd1cace644 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 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. @@ -26,7 +26,6 @@ import java.sql.Statement; import org.junit.Test; -import org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor; import org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor; import static org.junit.Assert.*; @@ -39,7 +38,7 @@ import static org.mockito.BDDMockito.*; public class NativeJdbcExtractorTests { @Test - public void testSimpleNativeJdbcExtractor() throws SQLException { + public void simpleNativeJdbcExtractor() throws SQLException { SimpleNativeJdbcExtractor extractor = new SimpleNativeJdbcExtractor(); Connection con = mock(Connection.class); @@ -76,8 +75,9 @@ public class NativeJdbcExtractorTests { assertEquals(nativeRs, rs); } - public void testCommonsDbcpNativeJdbcExtractor() throws SQLException { - CommonsDbcpNativeJdbcExtractor extractor = new CommonsDbcpNativeJdbcExtractor(); + @SuppressWarnings("deprecation") + public void commonsDbcpNativeJdbcExtractor() throws SQLException { + org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor extractor = new org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor(); assertFalse(extractor.isNativeConnectionNecessaryForNativeStatements()); Connection con = mock(Connection.class); diff --git a/spring-web/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java b/spring-web/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java index 78b587ef668..5001f9fb81b 100644 --- a/spring-web/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 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. @@ -17,23 +17,27 @@ package org.springframework.web.util; import java.net.URL; + import javax.servlet.ServletContextEvent; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.junit.Ignore; + import org.junit.Test; import org.springframework.core.io.FileSystemResourceLoader; import org.springframework.mock.web.test.MockServletContext; +import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; +import static org.junit.Assume.*; /** * @author Juergen Hoeller * @author Sam Brannen * @since 21.02.2005 */ +@SuppressWarnings("deprecation") public class Log4jWebConfigurerTests { private static final String TESTLOG4J_PROPERTIES = "testlog4j.properties"; @@ -78,9 +82,11 @@ public class Log4jWebConfigurerTests { initLogging(url.toString(), true); } - @Ignore("Only works on MS Windows") @Test public void initLoggingWithAbsoluteFilePathAndRefreshInterval() { + // Only works on MS Windows + assumeThat(System.getProperty("os.name"), containsString("Windows")); + URL url = Log4jWebConfigurerTests.class.getResource(TESTLOG4J_PROPERTIES); initLogging(url.getFile(), true); }