diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java b/org.springframework.test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java index 11e77382648..ca545b1ad90 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 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. @@ -77,6 +77,7 @@ import org.springframework.transaction.annotation.Transactional; * @see org.springframework.test.context.junit38.AbstractTransactionalJUnit38SpringContextTests * @see org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests */ +@SuppressWarnings("deprecation") @TestExecutionListeners(TransactionalTestExecutionListener.class) @Transactional public abstract class AbstractTransactionalJUnit4SpringContextTests extends AbstractJUnit4SpringContextTests { diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java b/org.springframework.test/src/main/java/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java index 9b29991627f..7e2bd68fa20 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2011 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. @@ -65,6 +65,7 @@ import org.springframework.transaction.annotation.Transactional; * @see org.springframework.test.context.junit38.AbstractTransactionalJUnit38SpringContextTests * @see org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests */ +@SuppressWarnings("deprecation") @TestExecutionListeners(TransactionalTestExecutionListener.class) @Transactional public abstract class AbstractTransactionalTestNGSpringContextTests extends AbstractTestNGSpringContextTests { @@ -94,7 +95,6 @@ public abstract class AbstractTransactionalTestNGSpringContextTests extends Abst this.sqlScriptEncoding = sqlScriptEncoding; } - /** * Count the rows in the given table. * @param tableName table name to count rows in @@ -125,12 +125,11 @@ public abstract class AbstractTransactionalTestNGSpringContextTests extends Abst * @throws DataAccessException if there is an error executing a statement * and continueOnError was false */ - protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) - throws DataAccessException { + protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException { Resource resource = this.applicationContext.getResource(sqlResourcePath); - SimpleJdbcTestUtils.executeSqlScript( - this.simpleJdbcTemplate, new EncodedResource(resource, this.sqlScriptEncoding), continueOnError); + SimpleJdbcTestUtils.executeSqlScript(this.simpleJdbcTemplate, new EncodedResource(resource, + this.sqlScriptEncoding), continueOnError); } } diff --git a/org.springframework.test/src/main/java/org/springframework/test/jdbc/SimpleJdbcTestUtils.java b/org.springframework.test/src/main/java/org/springframework/test/jdbc/SimpleJdbcTestUtils.java index 72b8d822d46..65d671f3d15 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/jdbc/SimpleJdbcTestUtils.java +++ b/org.springframework.test/src/main/java/org/springframework/test/jdbc/SimpleJdbcTestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2011 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. @@ -23,7 +23,6 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.support.EncodedResource; @@ -40,6 +39,7 @@ import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; * @author Thomas Risberg * @since 2.5 */ +@SuppressWarnings("deprecation") public abstract class SimpleJdbcTestUtils { private static final Log logger = LogFactory.getLog(SimpleJdbcTestUtils.class); @@ -86,9 +86,8 @@ public abstract class SimpleJdbcTestUtils { * @throws DataAccessException if there is an error executing a statement * and continueOnError was false */ - public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, - ResourceLoader resourceLoader, String sqlResourcePath, boolean continueOnError) - throws DataAccessException { + public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, ResourceLoader resourceLoader, + String sqlResourcePath, boolean continueOnError) throws DataAccessException { Resource resource = resourceLoader.getResource(sqlResourcePath); executeSqlScript(simpleJdbcTemplate, resource, continueOnError); @@ -107,8 +106,8 @@ public abstract class SimpleJdbcTestUtils { * @throws DataAccessException if there is an error executing a statement * and continueOnError was false */ - public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, - Resource resource, boolean continueOnError) throws DataAccessException { + public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, Resource resource, + boolean continueOnError) throws DataAccessException { executeSqlScript(simpleJdbcTemplate, new EncodedResource(resource), continueOnError); } @@ -126,8 +125,8 @@ public abstract class SimpleJdbcTestUtils { * @throws DataAccessException if there is an error executing a statement * and continueOnError was false */ - public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, - EncodedResource resource, boolean continueOnError) throws DataAccessException { + public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, EncodedResource resource, + boolean continueOnError) throws DataAccessException { if (logger.isInfoEnabled()) { logger.info("Executing SQL script from " + resource); @@ -140,7 +139,7 @@ public abstract class SimpleJdbcTestUtils { String script = JdbcTestUtils.readScript(lnr); char delimiter = ';'; if (!JdbcTestUtils.containsSqlScriptDelimiters(script, delimiter)) { - delimiter = '\n'; + delimiter = '\n'; } JdbcTestUtils.splitSqlScript(script, delimiter, statements); for (String statement : statements) { diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java index f18ccd9083c..9235841e498 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java @@ -39,7 +39,7 @@ import org.springframework.test.context.transaction.BeforeTransaction; import org.springframework.test.jdbc.SimpleJdbcTestUtils; /** - * Combined unit test for {@link AbstractJUnit38SpringContextTests} and + * Combined integration test for {@link AbstractJUnit38SpringContextTests} and * {@link AbstractTransactionalJUnit38SpringContextTests}. * * @author Sam Brannen diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit38/FailingBeforeAndAfterMethodsTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit38/FailingBeforeAndAfterMethodsTests.java index 86add467616..7fc6b8515c1 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit38/FailingBeforeAndAfterMethodsTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit38/FailingBeforeAndAfterMethodsTests.java @@ -38,7 +38,7 @@ import org.springframework.test.context.transaction.BeforeTransaction; /** *

- * JUnit 4 based unit test for verifying that 'before' and 'after' + * JUnit 4 based integration test for verifying that 'before' and 'after' * methods of {@link TestExecutionListener TestExecutionListeners} as well as * {@link BeforeTransaction @BeforeTransaction} and * {@link AfterTransaction @AfterTransaction} methods can fail a test in a JUnit diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/BeforeAndAfterTransactionAnnotationTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/BeforeAndAfterTransactionAnnotationTests.java index 044bb3f8beb..7dc2af2c636 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/BeforeAndAfterTransactionAnnotationTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/BeforeAndAfterTransactionAnnotationTests.java @@ -16,18 +16,17 @@ package org.springframework.test.context.junit4; -import javax.annotation.Resource; -import javax.sql.DataSource; - import static org.junit.Assert.assertEquals; import static org.springframework.test.transaction.TransactionTestUtils.assertInTransaction; +import javax.annotation.Resource; +import javax.sql.DataSource; + import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; - import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestExecutionListeners; @@ -37,16 +36,17 @@ import org.springframework.test.context.transaction.TransactionalTestExecutionLi import org.springframework.transaction.annotation.Transactional; /** - * JUnit 4 based unit test which verifies + * JUnit 4 based integration test which verifies * {@link BeforeTransaction @BeforeTransaction} and * {@link AfterTransaction @AfterTransaction} behavior. * * @author Sam Brannen * @since 2.5 */ +@SuppressWarnings("deprecation") @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration -@TestExecutionListeners({TransactionalTestExecutionListener.class}) +@TestExecutionListeners({ TransactionalTestExecutionListener.class }) public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactionalSpringRunnerTests { protected static SimpleJdbcTemplate simpleJdbcTemplate; @@ -66,14 +66,13 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio @AfterClass public static void afterClass() { assertEquals("Verifying the final number of rows in the person table after all tests.", 3, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); assertEquals("Verifying the total number of calls to beforeTransaction().", 2, - BeforeAndAfterTransactionAnnotationTests.numBeforeTransactionCalls); + BeforeAndAfterTransactionAnnotationTests.numBeforeTransactionCalls); assertEquals("Verifying the total number of calls to afterTransaction().", 2, - BeforeAndAfterTransactionAnnotationTests.numAfterTransactionCalls); + BeforeAndAfterTransactionAnnotationTests.numAfterTransactionCalls); } - @BeforeTransaction public void beforeTransaction() { assertInTransaction(false); @@ -90,12 +89,13 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio BeforeAndAfterTransactionAnnotationTests.numAfterTransactionCalls++; assertEquals("Deleting yoda", 1, deletePerson(simpleJdbcTemplate, YODA)); assertEquals("Verifying the number of rows in the person table after a transactional test method.", 0, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } @Before public void before() { - assertEquals("Verifying the number of rows in the person table before a test method.", (this.inTransaction ? 1 : 0), countRowsInPersonTable(simpleJdbcTemplate)); + assertEquals("Verifying the number of rows in the person table before a test method.", (this.inTransaction ? 1 + : 0), countRowsInPersonTable(simpleJdbcTemplate)); } @Test @@ -104,7 +104,7 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio assertInTransaction(true); assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE)); assertEquals("Verifying the number of rows in the person table within transactionalMethod1().", 2, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } @Test @@ -114,7 +114,7 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE)); assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE)); assertEquals("Verifying the number of rows in the person table within transactionalMethod2().", 3, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } @Test @@ -124,7 +124,7 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio assertEquals("Adding leia", 1, addPerson(simpleJdbcTemplate, LEIA)); assertEquals("Adding yoda", 1, addPerson(simpleJdbcTemplate, YODA)); assertEquals("Verifying the number of rows in the person table without a transaction.", 3, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java index f6e16ca48b2..a4c5c81ab40 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java @@ -38,7 +38,7 @@ import org.springframework.transaction.annotation.Transactional; /** *

- * JUnit 4 based unit test which verifies support of Spring's + * JUnit 4 based integration test which verifies support of Spring's * {@link Transactional @Transactional}, {@link NotTransactional * @NotTransactional}, {@link TestExecutionListeners * @TestExecutionListeners}, and {@link ContextConfiguration diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java index 3fcee7536ca..8348e5aad7a 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java @@ -43,7 +43,7 @@ import org.springframework.test.context.transaction.BeforeTransaction; import org.springframework.test.jdbc.SimpleJdbcTestUtils; /** - * Combined unit test for {@link AbstractJUnit4SpringContextTests} and + * Combined integration test for {@link AbstractJUnit4SpringContextTests} and * {@link AbstractTransactionalJUnit4SpringContextTests}. * * @author Sam Brannen diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java index ef440f13ff6..59f59ff21d1 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java @@ -28,7 +28,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.support.GenericPropertiesContextLoader; /** - * Unit tests which verify that a subclass of {@link SpringJUnit4ClassRunner} + * Integration tests which verify that a subclass of {@link SpringJUnit4ClassRunner} * can specify a custom default ContextLoader class name that overrides * the standard default class name. * diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackFalseTransactionalSpringRunnerTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackFalseTransactionalSpringRunnerTests.java index 3368cf88c29..546637f9d49 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackFalseTransactionalSpringRunnerTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackFalseTransactionalSpringRunnerTests.java @@ -26,7 +26,6 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; - import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.transaction.TransactionConfiguration; @@ -34,7 +33,7 @@ import org.springframework.transaction.annotation.Transactional; /** *

- * JUnit 4 based unit test which verifies proper transactional behavior when the + * JUnit 4 based integration test which verifies proper transactional behavior when the * {@link TransactionConfiguration#defaultRollback() defaultRollback} attribute * of the {@link TransactionConfiguration} annotation is set to false. * Also tests configuration of the @@ -45,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional; * @since 2.5 * @see TransactionConfiguration */ +@SuppressWarnings("deprecation") @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration @TransactionConfiguration(transactionManager = "txMgr", defaultRollback = false) @@ -57,7 +57,7 @@ public class DefaultRollbackFalseTransactionalSpringRunnerTests extends Abstract @AfterClass public static void verifyFinalTestData() { assertEquals("Verifying the final number of rows in the person table after all tests.", 2, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } @Before @@ -65,7 +65,7 @@ public class DefaultRollbackFalseTransactionalSpringRunnerTests extends Abstract clearPersonTable(simpleJdbcTemplate); assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB)); assertEquals("Verifying the initial number of rows in the person table.", 1, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } @Test @@ -75,7 +75,7 @@ public class DefaultRollbackFalseTransactionalSpringRunnerTests extends Abstract assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE)); assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE)); assertEquals("Verifying the number of rows in the person table within a transaction.", 2, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackTrueTransactionalSpringRunnerTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackTrueTransactionalSpringRunnerTests.java index 70d6f80fad7..6242ca35b08 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackTrueTransactionalSpringRunnerTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackTrueTransactionalSpringRunnerTests.java @@ -26,14 +26,13 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; - import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.transaction.annotation.Transactional; /** - * JUnit 4 based unit test which verifies proper transactional behavior when the + * JUnit 4 based integration test which verifies proper transactional behavior when the * {@link TransactionConfiguration#defaultRollback() defaultRollback} attribute * of the {@link TransactionConfiguration} annotation is set to true. * @@ -41,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional; * @since 2.5 * @see TransactionConfiguration */ +@SuppressWarnings("deprecation") @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration @TransactionConfiguration(defaultRollback = true) @@ -54,7 +54,7 @@ public class DefaultRollbackTrueTransactionalSpringRunnerTests extends AbstractT @AfterClass public static void verifyFinalTestData() { assertEquals("Verifying the final number of rows in the person table after all tests.", originalNumRows, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } @Before @@ -62,7 +62,7 @@ public class DefaultRollbackTrueTransactionalSpringRunnerTests extends AbstractT originalNumRows = clearPersonTable(simpleJdbcTemplate); assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB)); assertEquals("Verifying the initial number of rows in the person table.", 1, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } @Test(timeout = 1000) @@ -72,7 +72,7 @@ public class DefaultRollbackTrueTransactionalSpringRunnerTests extends AbstractT assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE)); assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE)); assertEquals("Verifying the number of rows in the person table within a transaction.", 3, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsTests.java index cf09b34cf33..12670d83d24 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsTests.java @@ -37,7 +37,7 @@ import org.springframework.test.context.transaction.BeforeTransaction; /** *

- * JUnit 4 based unit test for verifying that 'before' and 'after' + * JUnit 4 based integration test for verifying that 'before' and 'after' * methods of {@link TestExecutionListener TestExecutionListeners} as well as * {@link BeforeTransaction @BeforeTransaction} and * {@link AfterTransaction @AfterTransaction} methods can fail a test in a @@ -138,7 +138,7 @@ public class FailingBeforeAndAfterMethodsTests { } @RunWith(SpringJUnit4ClassRunner.class) - @TestExecutionListeners( {}) + @TestExecutionListeners({}) public static abstract class BaseTestCase { @Test diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java index 8cd6a80c7f7..b553904583c 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java @@ -37,7 +37,7 @@ import org.springframework.transaction.annotation.Transactional; /** *

- * JUnit 4 based unit test which verifies support of Spring's + * JUnit 4 based integration test which verifies support of Spring's * {@link Transactional @Transactional}, {@link TestExecutionListeners * @TestExecutionListeners}, and {@link ContextConfiguration * @ContextConfiguration} annotations in conjunction with the @@ -60,6 +60,7 @@ import org.springframework.transaction.annotation.Transactional; * @since 2.5 * @see ClassLevelTransactionalSpringRunnerTests */ +@SuppressWarnings("deprecation") @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests.java index 18bf66092b2..ed2f58de118 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests.java @@ -31,7 +31,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; - import org.springframework.beans.Employee; import org.springframework.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; @@ -42,7 +41,7 @@ import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; /** - * Simple JUnit 4 based unit test which demonstrates how to use JUnit's + * Simple JUnit 4 based integration test which demonstrates how to use JUnit's * {@link Parameterized} Runner in conjunction with * {@link ContextConfiguration @ContextConfiguration}, the * {@link DependencyInjectionTestExecutionListener}, and a @@ -54,7 +53,7 @@ import org.springframework.test.context.support.DependencyInjectionTestExecution */ @RunWith(Parameterized.class) @ContextConfiguration -@TestExecutionListeners( { DependencyInjectionTestExecutionListener.class }) +@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class }) public class ParameterizedDependencyInjectionTests { private static final List employees = new ArrayList(); diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests.java index a3945a4ed4a..231ea884b39 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests.java @@ -25,7 +25,6 @@ import javax.sql.DataSource; import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; - import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; @@ -39,6 +38,7 @@ import org.springframework.test.context.ContextConfiguration; * @since 2.5 * @see Rollback */ +@SuppressWarnings("deprecation") @ContextConfiguration public class RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests extends DefaultRollbackFalseTransactionalSpringRunnerTests { @@ -51,7 +51,7 @@ public class RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests @AfterClass public static void verifyFinalTestData() { assertEquals("Verifying the final number of rows in the person table after all tests.", originalNumRows, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } @Before @@ -60,7 +60,7 @@ public class RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests originalNumRows = clearPersonTable(simpleJdbcTemplate); assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB)); assertEquals("Verifying the initial number of rows in the person table.", 1, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } @Test @@ -72,7 +72,7 @@ public class RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE)); assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE)); assertEquals("Verifying the number of rows in the person table within a transaction.", 2, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests.java index d6e59ac5898..22f0c6ebe81 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests.java @@ -25,7 +25,6 @@ import javax.sql.DataSource; import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; - import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; @@ -40,6 +39,7 @@ import org.springframework.transaction.annotation.Transactional; * @since 2.5 * @see Rollback */ +@SuppressWarnings("deprecation") @ContextConfiguration public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests extends DefaultRollbackTrueTransactionalSpringRunnerTests { @@ -50,7 +50,7 @@ public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests e @AfterClass public static void verifyFinalTestData() { assertEquals("Verifying the final number of rows in the person table after all tests.", 3, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } @Before @@ -58,10 +58,9 @@ public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests e clearPersonTable(simpleJdbcTemplate); assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB)); assertEquals("Verifying the initial number of rows in the person table.", 1, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } - @Test @Transactional @Rollback(false) @@ -70,7 +69,7 @@ public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests e assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE)); assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE)); assertEquals("Verifying the number of rows in the person table within a transaction.", 3, - countRowsInPersonTable(simpleJdbcTemplate)); + countRowsInPersonTable(simpleJdbcTemplate)); } diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java index 7e4254edeaa..1dd4494dd69 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java @@ -27,7 +27,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.transaction.annotation.Transactional; /** - * JUnit 4 based unit test which verifies support of Spring's + * JUnit 4 based integration test which verifies support of Spring's * {@link Transactional @Transactional} and {@link NotTransactional * @NotTransactional} annotations in conjunction with {@link Timed * @Timed} and JUnit 4's {@link Test#timeout() timeout} attribute. diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/spr3896/BeanOverridingDefaultLocationsInheritedTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/spr3896/BeanOverridingDefaultLocationsInheritedTests.java index 051f97a4668..cf46ce66eae 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/spr3896/BeanOverridingDefaultLocationsInheritedTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/spr3896/BeanOverridingDefaultLocationsInheritedTests.java @@ -23,7 +23,7 @@ import org.junit.Test; import org.springframework.test.context.ContextConfiguration; /** - * JUnit 4 based unit test for verifying support for the + * JUnit 4 based integration test for verifying support for the * {@link ContextConfiguration#inheritLocations() inheritLocations} flag of * {@link ContextConfiguration @ContextConfiguration} indirectly proposed in SPR-6128. * diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java index 0e763ab8495..c8bc3811eb5 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java @@ -16,10 +16,10 @@ package org.springframework.test.context.testng; -import static org.junit.Assert.assertNotNull; import static org.springframework.test.transaction.TransactionTestUtils.assertInTransaction; import static org.springframework.test.transaction.TransactionTestUtils.inTransaction; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; import javax.sql.DataSource; @@ -113,11 +113,11 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests extends @Test @NotTransactional public void autowiringFromConfigClass() { - assertNotNull("The employee should have been autowired.", employee); - assertEquals("John Smith", employee.getName()); + assertNotNull(employee, "The employee should have been autowired."); + assertEquals(employee.getName(), "John Smith"); - assertNotNull("The pet should have been autowired.", pet); - assertEquals("Fido", pet.getName()); + assertNotNull(pet, "The pet should have been autowired."); + assertEquals(pet.getName(), "Fido"); } @BeforeTransaction diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java index 06060043ce8..5f6840f495b 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java @@ -41,7 +41,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; /** - * Combined unit test for {@link AbstractTestNGSpringContextTests} and + * Combined integration test for {@link AbstractTestNGSpringContextTests} and * {@link AbstractTransactionalTestNGSpringContextTests}. * * @author Sam Brannen diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java index f7faa13295b..7d956ee6f95 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java @@ -29,7 +29,7 @@ import org.testng.annotations.Test; /** *

- * TestNG based unit test to assess the claim in SPR-3880 that a "context marked dirty using * {@link DirtiesContext @DirtiesContext} in [a] TestNG based test is not diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/testng/FailingBeforeAndAfterMethodsTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/testng/FailingBeforeAndAfterMethodsTests.java index 764a9b0c055..ab76d69d472 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/testng/FailingBeforeAndAfterMethodsTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/testng/FailingBeforeAndAfterMethodsTests.java @@ -39,7 +39,7 @@ import org.testng.TestNG; /** *

- * JUnit 4 based unit test for verifying that 'before' and 'after' + * JUnit 4 based integration test for verifying that 'before' and 'after' * methods of {@link TestExecutionListener TestExecutionListeners} as well as * {@link BeforeTransaction @BeforeTransaction} and * {@link AfterTransaction @AfterTransaction} methods can fail a test in a