提交 0d4469d8 编写于 作者: S Sam Brannen

Suppressing warnings for deprecation of SimpleJdbcTemplate; polishing JavaDoc;...

Suppressing warnings for deprecation of SimpleJdbcTemplate; polishing JavaDoc; using TestNG assertions in TestNG tests.
上级 266e1096
/*
* 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 {
......
/*
* 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 <code>false</code>
*/
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);
}
}
/*
* 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 <code>false</code>
*/
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 <code>false</code>
*/
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 <code>false</code>
*/
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) {
......
......@@ -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
......
......@@ -38,7 +38,7 @@ import org.springframework.test.context.transaction.BeforeTransaction;
/**
* <p>
* JUnit 4 based unit test for verifying that '<em>before</em>' and '<em>after</em>'
* JUnit 4 based integration test for verifying that '<em>before</em>' and '<em>after</em>'
* methods of {@link TestExecutionListener TestExecutionListeners} as well as
* {@link BeforeTransaction @BeforeTransaction} and
* {@link AfterTransaction @AfterTransaction} methods can fail a test in a JUnit
......
......@@ -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));
}
......
......@@ -38,7 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* JUnit 4 based unit test which verifies support of Spring's
* JUnit 4 based integration test which verifies support of Spring's
* {@link Transactional &#64;Transactional}, {@link NotTransactional
* &#64;NotTransactional}, {@link TestExecutionListeners
* &#64;TestExecutionListeners}, and {@link ContextConfiguration
......
......@@ -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
......
......@@ -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 <em>default ContextLoader class name</em> that overrides
* the standard default class name.
*
......
......@@ -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;
/**
* <p>
* 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 <strong><code>false</code></strong>.
* 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));
}
......
......@@ -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 <strong><code>true</code></strong>.
*
......@@ -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));
}
......
......@@ -37,7 +37,7 @@ import org.springframework.test.context.transaction.BeforeTransaction;
/**
* <p>
* JUnit 4 based unit test for verifying that '<i>before</i>' and '<i>after</i>'
* JUnit 4 based integration test for verifying that '<i>before</i>' and '<i>after</i>'
* methods of {@link TestExecutionListener TestExecutionListeners} as well as
* {@link BeforeTransaction &#064;BeforeTransaction} and
* {@link AfterTransaction &#064;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
......
......@@ -37,7 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* JUnit 4 based unit test which verifies support of Spring's
* JUnit 4 based integration test which verifies support of Spring's
* {@link Transactional &#64;Transactional}, {@link TestExecutionListeners
* &#64;TestExecutionListeners}, and {@link ContextConfiguration
* &#64;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,
......
......@@ -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<Employee> employees = new ArrayList<Employee>();
......
......@@ -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));
}
......
......@@ -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));
}
......
......@@ -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 &#64;Transactional} and {@link NotTransactional
* &#64;NotTransactional} annotations in conjunction with {@link Timed
* &#64;Timed} and JUnit 4's {@link Test#timeout() timeout} attribute.
......
......@@ -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 <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"
......
......@@ -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 <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"
......
......@@ -27,7 +27,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* 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 <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"
......
......@@ -25,7 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
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 <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"
......
......@@ -27,7 +27,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* 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 <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"
......
......@@ -25,7 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
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 <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"
......
......@@ -27,7 +27,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Unit tests to verify claims made in <a
* Integration tests to verify claims made in <a
* href="http://jira.springframework.org/browse/SPR-6128"
* target="_blank">SPR-6128</a>.
*
......
......@@ -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
......
......@@ -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
......
......@@ -29,7 +29,7 @@ import org.testng.annotations.Test;
/**
* <p>
* TestNG based unit test to assess the claim in <a
* TestNG based integration test to assess the claim in <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3880"
* target="_blank">SPR-3880</a> that a &quot;context marked dirty using
* {@link DirtiesContext &#064;DirtiesContext} in [a] TestNG based test is not
......
......@@ -39,7 +39,7 @@ import org.testng.TestNG;
/**
* <p>
* JUnit 4 based unit test for verifying that '<i>before</i>' and '<i>after</i>'
* JUnit 4 based integration test for verifying that '<i>before</i>' and '<i>after</i>'
* methods of {@link TestExecutionListener TestExecutionListeners} as well as
* {@link BeforeTransaction &#064;BeforeTransaction} and
* {@link AfterTransaction &#064;AfterTransaction} methods can fail a test in a
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册