Suppressing warnings for deprecation of SimpleJdbcTemplate; polishing JavaDoc; using TestNG assertions in TestNG tests.

This commit is contained in:
Sam Brannen 2011-06-03 14:10:16 +00:00
parent 266e1096ce
commit 0d4469d8e3
28 changed files with 76 additions and 78 deletions

View File

@ -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"); * 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.
@ -77,6 +77,7 @@ import org.springframework.transaction.annotation.Transactional;
* @see org.springframework.test.context.junit38.AbstractTransactionalJUnit38SpringContextTests * @see org.springframework.test.context.junit38.AbstractTransactionalJUnit38SpringContextTests
* @see org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests * @see org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests
*/ */
@SuppressWarnings("deprecation")
@TestExecutionListeners(TransactionalTestExecutionListener.class) @TestExecutionListeners(TransactionalTestExecutionListener.class)
@Transactional @Transactional
public abstract class AbstractTransactionalJUnit4SpringContextTests extends AbstractJUnit4SpringContextTests { public abstract class AbstractTransactionalJUnit4SpringContextTests extends AbstractJUnit4SpringContextTests {

View File

@ -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"); * 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.
@ -65,6 +65,7 @@ import org.springframework.transaction.annotation.Transactional;
* @see org.springframework.test.context.junit38.AbstractTransactionalJUnit38SpringContextTests * @see org.springframework.test.context.junit38.AbstractTransactionalJUnit38SpringContextTests
* @see org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests * @see org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests
*/ */
@SuppressWarnings("deprecation")
@TestExecutionListeners(TransactionalTestExecutionListener.class) @TestExecutionListeners(TransactionalTestExecutionListener.class)
@Transactional @Transactional
public abstract class AbstractTransactionalTestNGSpringContextTests extends AbstractTestNGSpringContextTests { public abstract class AbstractTransactionalTestNGSpringContextTests extends AbstractTestNGSpringContextTests {
@ -94,7 +95,6 @@ public abstract class AbstractTransactionalTestNGSpringContextTests extends Abst
this.sqlScriptEncoding = sqlScriptEncoding; this.sqlScriptEncoding = sqlScriptEncoding;
} }
/** /**
* Count the rows in the given table. * Count the rows in the given table.
* @param tableName table name to count rows in * @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 * @throws DataAccessException if there is an error executing a statement
* and continueOnError was <code>false</code> * and continueOnError was <code>false</code>
*/ */
protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {
throws DataAccessException {
Resource resource = this.applicationContext.getResource(sqlResourcePath); Resource resource = this.applicationContext.getResource(sqlResourcePath);
SimpleJdbcTestUtils.executeSqlScript( SimpleJdbcTestUtils.executeSqlScript(this.simpleJdbcTemplate, new EncodedResource(resource,
this.simpleJdbcTemplate, new EncodedResource(resource, this.sqlScriptEncoding), continueOnError); this.sqlScriptEncoding), continueOnError);
} }
} }

View File

@ -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"); * 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.
@ -23,7 +23,6 @@ import java.util.List;
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.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.EncodedResource; import org.springframework.core.io.support.EncodedResource;
@ -40,6 +39,7 @@ import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
* @author Thomas Risberg * @author Thomas Risberg
* @since 2.5 * @since 2.5
*/ */
@SuppressWarnings("deprecation")
public abstract class SimpleJdbcTestUtils { public abstract class SimpleJdbcTestUtils {
private static final Log logger = LogFactory.getLog(SimpleJdbcTestUtils.class); 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 * @throws DataAccessException if there is an error executing a statement
* and continueOnError was <code>false</code> * and continueOnError was <code>false</code>
*/ */
public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, ResourceLoader resourceLoader,
ResourceLoader resourceLoader, String sqlResourcePath, boolean continueOnError) String sqlResourcePath, boolean continueOnError) throws DataAccessException {
throws DataAccessException {
Resource resource = resourceLoader.getResource(sqlResourcePath); Resource resource = resourceLoader.getResource(sqlResourcePath);
executeSqlScript(simpleJdbcTemplate, resource, continueOnError); executeSqlScript(simpleJdbcTemplate, resource, continueOnError);
@ -107,8 +106,8 @@ public abstract class SimpleJdbcTestUtils {
* @throws DataAccessException if there is an error executing a statement * @throws DataAccessException if there is an error executing a statement
* and continueOnError was <code>false</code> * and continueOnError was <code>false</code>
*/ */
public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, Resource resource,
Resource resource, boolean continueOnError) throws DataAccessException { boolean continueOnError) throws DataAccessException {
executeSqlScript(simpleJdbcTemplate, new EncodedResource(resource), continueOnError); executeSqlScript(simpleJdbcTemplate, new EncodedResource(resource), continueOnError);
} }
@ -126,8 +125,8 @@ public abstract class SimpleJdbcTestUtils {
* @throws DataAccessException if there is an error executing a statement * @throws DataAccessException if there is an error executing a statement
* and continueOnError was <code>false</code> * and continueOnError was <code>false</code>
*/ */
public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, EncodedResource resource,
EncodedResource resource, boolean continueOnError) throws DataAccessException { boolean continueOnError) throws DataAccessException {
if (logger.isInfoEnabled()) { if (logger.isInfoEnabled()) {
logger.info("Executing SQL script from " + resource); logger.info("Executing SQL script from " + resource);

View File

@ -39,7 +39,7 @@ import org.springframework.test.context.transaction.BeforeTransaction;
import org.springframework.test.jdbc.SimpleJdbcTestUtils; import org.springframework.test.jdbc.SimpleJdbcTestUtils;
/** /**
* Combined unit test for {@link AbstractJUnit38SpringContextTests} and * Combined integration test for {@link AbstractJUnit38SpringContextTests} and
* {@link AbstractTransactionalJUnit38SpringContextTests}. * {@link AbstractTransactionalJUnit38SpringContextTests}.
* *
* @author Sam Brannen * @author Sam Brannen

View File

@ -38,7 +38,7 @@ import org.springframework.test.context.transaction.BeforeTransaction;
/** /**
* <p> * <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 * methods of {@link TestExecutionListener TestExecutionListeners} as well as
* {@link BeforeTransaction @BeforeTransaction} and * {@link BeforeTransaction @BeforeTransaction} and
* {@link AfterTransaction @AfterTransaction} methods can fail a test in a JUnit * {@link AfterTransaction @AfterTransaction} methods can fail a test in a JUnit

View File

@ -16,18 +16,17 @@
package org.springframework.test.context.junit4; package org.springframework.test.context.junit4;
import javax.annotation.Resource;
import javax.sql.DataSource;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.springframework.test.transaction.TransactionTestUtils.assertInTransaction; import static org.springframework.test.transaction.TransactionTestUtils.assertInTransaction;
import javax.annotation.Resource;
import javax.sql.DataSource;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.TestExecutionListeners;
@ -37,13 +36,14 @@ import org.springframework.test.context.transaction.TransactionalTestExecutionLi
import org.springframework.transaction.annotation.Transactional; 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 BeforeTransaction @BeforeTransaction} and
* {@link AfterTransaction @AfterTransaction} behavior. * {@link AfterTransaction @AfterTransaction} behavior.
* *
* @author Sam Brannen * @author Sam Brannen
* @since 2.5 * @since 2.5
*/ */
@SuppressWarnings("deprecation")
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration @ContextConfiguration
@TestExecutionListeners({ TransactionalTestExecutionListener.class }) @TestExecutionListeners({ TransactionalTestExecutionListener.class })
@ -73,7 +73,6 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio
BeforeAndAfterTransactionAnnotationTests.numAfterTransactionCalls); BeforeAndAfterTransactionAnnotationTests.numAfterTransactionCalls);
} }
@BeforeTransaction @BeforeTransaction
public void beforeTransaction() { public void beforeTransaction() {
assertInTransaction(false); assertInTransaction(false);
@ -95,7 +94,8 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio
@Before @Before
public void 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 @Test

View File

@ -38,7 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
/** /**
* <p> * <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 * {@link Transactional &#64;Transactional}, {@link NotTransactional
* &#64;NotTransactional}, {@link TestExecutionListeners * &#64;NotTransactional}, {@link TestExecutionListeners
* &#64;TestExecutionListeners}, and {@link ContextConfiguration * &#64;TestExecutionListeners}, and {@link ContextConfiguration

View File

@ -43,7 +43,7 @@ import org.springframework.test.context.transaction.BeforeTransaction;
import org.springframework.test.jdbc.SimpleJdbcTestUtils; import org.springframework.test.jdbc.SimpleJdbcTestUtils;
/** /**
* Combined unit test for {@link AbstractJUnit4SpringContextTests} and * Combined integration test for {@link AbstractJUnit4SpringContextTests} and
* {@link AbstractTransactionalJUnit4SpringContextTests}. * {@link AbstractTransactionalJUnit4SpringContextTests}.
* *
* @author Sam Brannen * @author Sam Brannen

View File

@ -28,7 +28,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.support.GenericPropertiesContextLoader; 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 * can specify a custom <em>default ContextLoader class name</em> that overrides
* the standard default class name. * the standard default class name.
* *

View File

@ -26,7 +26,6 @@ import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.test.context.transaction.TransactionConfiguration;
@ -34,7 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
/** /**
* <p> * <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 * {@link TransactionConfiguration#defaultRollback() defaultRollback} attribute
* of the {@link TransactionConfiguration} annotation is set to <strong><code>false</code></strong>. * of the {@link TransactionConfiguration} annotation is set to <strong><code>false</code></strong>.
* Also tests configuration of the * Also tests configuration of the
@ -45,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
* @since 2.5 * @since 2.5
* @see TransactionConfiguration * @see TransactionConfiguration
*/ */
@SuppressWarnings("deprecation")
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration @ContextConfiguration
@TransactionConfiguration(transactionManager = "txMgr", defaultRollback = false) @TransactionConfiguration(transactionManager = "txMgr", defaultRollback = false)

View File

@ -26,14 +26,13 @@ import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional; 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 * {@link TransactionConfiguration#defaultRollback() defaultRollback} attribute
* of the {@link TransactionConfiguration} annotation is set to <strong><code>true</code></strong>. * 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 * @since 2.5
* @see TransactionConfiguration * @see TransactionConfiguration
*/ */
@SuppressWarnings("deprecation")
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration @ContextConfiguration
@TransactionConfiguration(defaultRollback = true) @TransactionConfiguration(defaultRollback = true)

View File

@ -37,7 +37,7 @@ import org.springframework.test.context.transaction.BeforeTransaction;
/** /**
* <p> * <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 * methods of {@link TestExecutionListener TestExecutionListeners} as well as
* {@link BeforeTransaction &#064;BeforeTransaction} and * {@link BeforeTransaction &#064;BeforeTransaction} and
* {@link AfterTransaction &#064;AfterTransaction} methods can fail a test in a * {@link AfterTransaction &#064;AfterTransaction} methods can fail a test in a

View File

@ -37,7 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
/** /**
* <p> * <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 * {@link Transactional &#64;Transactional}, {@link TestExecutionListeners
* &#64;TestExecutionListeners}, and {@link ContextConfiguration * &#64;TestExecutionListeners}, and {@link ContextConfiguration
* &#64;ContextConfiguration} annotations in conjunction with the * &#64;ContextConfiguration} annotations in conjunction with the
@ -60,6 +60,7 @@ import org.springframework.transaction.annotation.Transactional;
* @since 2.5 * @since 2.5
* @see ClassLevelTransactionalSpringRunnerTests * @see ClassLevelTransactionalSpringRunnerTests
*/ */
@SuppressWarnings("deprecation")
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration @ContextConfiguration
@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class,

View File

@ -31,7 +31,6 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.Parameters;
import org.springframework.beans.Employee; import org.springframework.beans.Employee;
import org.springframework.beans.Pet; import org.springframework.beans.Pet;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -42,7 +41,7 @@ import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; 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 Parameterized} Runner in conjunction with
* {@link ContextConfiguration @ContextConfiguration}, the * {@link ContextConfiguration @ContextConfiguration}, the
* {@link DependencyInjectionTestExecutionListener}, and a * {@link DependencyInjectionTestExecutionListener}, and a

View File

@ -25,7 +25,6 @@ import javax.sql.DataSource;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.annotation.Rollback; import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
@ -39,6 +38,7 @@ import org.springframework.test.context.ContextConfiguration;
* @since 2.5 * @since 2.5
* @see Rollback * @see Rollback
*/ */
@SuppressWarnings("deprecation")
@ContextConfiguration @ContextConfiguration
public class RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests extends public class RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests extends
DefaultRollbackFalseTransactionalSpringRunnerTests { DefaultRollbackFalseTransactionalSpringRunnerTests {

View File

@ -25,7 +25,6 @@ import javax.sql.DataSource;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.annotation.Rollback; import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
@ -40,6 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
* @since 2.5 * @since 2.5
* @see Rollback * @see Rollback
*/ */
@SuppressWarnings("deprecation")
@ContextConfiguration @ContextConfiguration
public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests extends public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests extends
DefaultRollbackTrueTransactionalSpringRunnerTests { DefaultRollbackTrueTransactionalSpringRunnerTests {
@ -61,7 +61,6 @@ public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests e
countRowsInPersonTable(simpleJdbcTemplate)); countRowsInPersonTable(simpleJdbcTemplate));
} }
@Test @Test
@Transactional @Transactional
@Rollback(false) @Rollback(false)

View File

@ -27,7 +27,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.annotation.Transactional; 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 * {@link Transactional &#64;Transactional} and {@link NotTransactional
* &#64;NotTransactional} annotations in conjunction with {@link Timed * &#64;NotTransactional} annotations in conjunction with {@link Timed
* &#64;Timed} and JUnit 4's {@link Test#timeout() timeout} attribute. * &#64;Timed} and JUnit 4's {@link Test#timeout() timeout} attribute.

View File

@ -23,7 +23,7 @@ import org.junit.Test;
import org.springframework.test.context.ContextConfiguration; 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#inheritLocations() inheritLocations} flag of
* {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a * {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896" * href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"

View File

@ -23,7 +23,7 @@ import org.junit.Test;
import org.springframework.test.context.ContextConfiguration; 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#inheritLocations() inheritLocations} flag of
* {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a * {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896" * href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"

View File

@ -27,7 +27,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 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#inheritLocations() inheritLocations} flag of
* {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a * {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896" * href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"

View File

@ -25,7 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; 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#inheritLocations() inheritLocations} flag of
* {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a * {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896" * href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"

View File

@ -27,7 +27,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 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#inheritLocations() inheritLocations} flag of
* {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a * {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896" * href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"

View File

@ -25,7 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; 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#inheritLocations() inheritLocations} flag of
* {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a * {@link ContextConfiguration @ContextConfiguration} indirectly proposed in <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896" * href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896"

View File

@ -27,7 +27,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 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" * href="http://jira.springframework.org/browse/SPR-6128"
* target="_blank">SPR-6128</a>. * target="_blank">SPR-6128</a>.
* *

View File

@ -16,10 +16,10 @@
package org.springframework.test.context.testng; 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.assertInTransaction;
import static org.springframework.test.transaction.TransactionTestUtils.inTransaction; import static org.springframework.test.transaction.TransactionTestUtils.inTransaction;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import javax.sql.DataSource; import javax.sql.DataSource;
@ -113,11 +113,11 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests extends
@Test @Test
@NotTransactional @NotTransactional
public void autowiringFromConfigClass() { public void autowiringFromConfigClass() {
assertNotNull("The employee should have been autowired.", employee); assertNotNull(employee, "The employee should have been autowired.");
assertEquals("John Smith", employee.getName()); assertEquals(employee.getName(), "John Smith");
assertNotNull("The pet should have been autowired.", pet); assertNotNull(pet, "The pet should have been autowired.");
assertEquals("Fido", pet.getName()); assertEquals(pet.getName(), "Fido");
} }
@BeforeTransaction @BeforeTransaction

View File

@ -41,7 +41,7 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* Combined unit test for {@link AbstractTestNGSpringContextTests} and * Combined integration test for {@link AbstractTestNGSpringContextTests} and
* {@link AbstractTransactionalTestNGSpringContextTests}. * {@link AbstractTransactionalTestNGSpringContextTests}.
* *
* @author Sam Brannen * @author Sam Brannen

View File

@ -29,7 +29,7 @@ import org.testng.annotations.Test;
/** /**
* <p> * <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" * href="http://opensource.atlassian.com/projects/spring/browse/SPR-3880"
* target="_blank">SPR-3880</a> that a &quot;context marked dirty using * target="_blank">SPR-3880</a> that a &quot;context marked dirty using
* {@link DirtiesContext &#064;DirtiesContext} in [a] TestNG based test is not * {@link DirtiesContext &#064;DirtiesContext} in [a] TestNG based test is not

View File

@ -39,7 +39,7 @@ import org.testng.TestNG;
/** /**
* <p> * <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 * methods of {@link TestExecutionListener TestExecutionListeners} as well as
* {@link BeforeTransaction &#064;BeforeTransaction} and * {@link BeforeTransaction &#064;BeforeTransaction} and
* {@link AfterTransaction &#064;AfterTransaction} methods can fail a test in a * {@link AfterTransaction &#064;AfterTransaction} methods can fail a test in a