Suppress recent deprecation warnings in tests

This commit is contained in:
Sam Brannen 2015-08-27 17:57:50 +02:00
parent abc805819f
commit 8af0151f1b
3 changed files with 15 additions and 8 deletions

View File

@ -30,6 +30,7 @@ import static org.junit.Assert.*;
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
*/ */
@SuppressWarnings("deprecation")
public class Log4jConfigurerTests { public class Log4jConfigurerTests {
@Test @Test

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.junit.Test;
import org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor;
import org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor; import org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -39,7 +38,7 @@ import static org.mockito.BDDMockito.*;
public class NativeJdbcExtractorTests { public class NativeJdbcExtractorTests {
@Test @Test
public void testSimpleNativeJdbcExtractor() throws SQLException { public void simpleNativeJdbcExtractor() throws SQLException {
SimpleNativeJdbcExtractor extractor = new SimpleNativeJdbcExtractor(); SimpleNativeJdbcExtractor extractor = new SimpleNativeJdbcExtractor();
Connection con = mock(Connection.class); Connection con = mock(Connection.class);
@ -76,8 +75,9 @@ public class NativeJdbcExtractorTests {
assertEquals(nativeRs, rs); assertEquals(nativeRs, rs);
} }
public void testCommonsDbcpNativeJdbcExtractor() throws SQLException { @SuppressWarnings("deprecation")
CommonsDbcpNativeJdbcExtractor extractor = new CommonsDbcpNativeJdbcExtractor(); public void commonsDbcpNativeJdbcExtractor() throws SQLException {
org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor extractor = new org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor();
assertFalse(extractor.isNativeConnectionNecessaryForNativeStatements()); assertFalse(extractor.isNativeConnectionNecessaryForNativeStatements());
Connection con = mock(Connection.class); Connection con = mock(Connection.class);

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,23 +17,27 @@
package org.springframework.web.util; package org.springframework.web.util;
import java.net.URL; import java.net.URL;
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextEvent;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.springframework.core.io.FileSystemResourceLoader; import org.springframework.core.io.FileSystemResourceLoader;
import org.springframework.mock.web.test.MockServletContext; import org.springframework.mock.web.test.MockServletContext;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.junit.Assume.*;
/** /**
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @since 21.02.2005 * @since 21.02.2005
*/ */
@SuppressWarnings("deprecation")
public class Log4jWebConfigurerTests { public class Log4jWebConfigurerTests {
private static final String TESTLOG4J_PROPERTIES = "testlog4j.properties"; private static final String TESTLOG4J_PROPERTIES = "testlog4j.properties";
@ -78,9 +82,11 @@ public class Log4jWebConfigurerTests {
initLogging(url.toString(), true); initLogging(url.toString(), true);
} }
@Ignore("Only works on MS Windows")
@Test @Test
public void initLoggingWithAbsoluteFilePathAndRefreshInterval() { public void initLoggingWithAbsoluteFilePathAndRefreshInterval() {
// Only works on MS Windows
assumeThat(System.getProperty("os.name"), containsString("Windows"));
URL url = Log4jWebConfigurerTests.class.getResource(TESTLOG4J_PROPERTIES); URL url = Log4jWebConfigurerTests.class.getResource(TESTLOG4J_PROPERTIES);
initLogging(url.getFile(), true); initLogging(url.getFile(), true);
} }