Suppressing warnings for deprecation of SimpleJdbcTemplate; polishing JavaDoc; using TestNG assertions in TestNG tests.
This commit is contained in:
parent
266e1096ce
commit
0d4469d8e3
|
|
@ -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 {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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,16 +36,17 @@ 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 })
|
||||||
public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactionalSpringRunnerTests {
|
public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactionalSpringRunnerTests {
|
||||||
|
|
||||||
protected static SimpleJdbcTemplate simpleJdbcTemplate;
|
protected static SimpleJdbcTemplate simpleJdbcTemplate;
|
||||||
|
|
@ -66,14 +66,13 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClass() {
|
public static void afterClass() {
|
||||||
assertEquals("Verifying the final number of rows in the person table after all tests.", 3,
|
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,
|
assertEquals("Verifying the total number of calls to beforeTransaction().", 2,
|
||||||
BeforeAndAfterTransactionAnnotationTests.numBeforeTransactionCalls);
|
BeforeAndAfterTransactionAnnotationTests.numBeforeTransactionCalls);
|
||||||
assertEquals("Verifying the total number of calls to afterTransaction().", 2,
|
assertEquals("Verifying the total number of calls to afterTransaction().", 2,
|
||||||
BeforeAndAfterTransactionAnnotationTests.numAfterTransactionCalls);
|
BeforeAndAfterTransactionAnnotationTests.numAfterTransactionCalls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@BeforeTransaction
|
@BeforeTransaction
|
||||||
public void beforeTransaction() {
|
public void beforeTransaction() {
|
||||||
assertInTransaction(false);
|
assertInTransaction(false);
|
||||||
|
|
@ -90,12 +89,13 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio
|
||||||
BeforeAndAfterTransactionAnnotationTests.numAfterTransactionCalls++;
|
BeforeAndAfterTransactionAnnotationTests.numAfterTransactionCalls++;
|
||||||
assertEquals("Deleting yoda", 1, deletePerson(simpleJdbcTemplate, YODA));
|
assertEquals("Deleting yoda", 1, deletePerson(simpleJdbcTemplate, YODA));
|
||||||
assertEquals("Verifying the number of rows in the person table after a transactional test method.", 0,
|
assertEquals("Verifying the number of rows in the person table after a transactional test method.", 0,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
||||||
|
|
@ -104,7 +104,7 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio
|
||||||
assertInTransaction(true);
|
assertInTransaction(true);
|
||||||
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
||||||
assertEquals("Verifying the number of rows in the person table within transactionalMethod1().", 2,
|
assertEquals("Verifying the number of rows in the person table within transactionalMethod1().", 2,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -114,7 +114,7 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio
|
||||||
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
||||||
assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE));
|
assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE));
|
||||||
assertEquals("Verifying the number of rows in the person table within transactionalMethod2().", 3,
|
assertEquals("Verifying the number of rows in the person table within transactionalMethod2().", 3,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -124,7 +124,7 @@ public class BeforeAndAfterTransactionAnnotationTests extends AbstractTransactio
|
||||||
assertEquals("Adding leia", 1, addPerson(simpleJdbcTemplate, LEIA));
|
assertEquals("Adding leia", 1, addPerson(simpleJdbcTemplate, LEIA));
|
||||||
assertEquals("Adding yoda", 1, addPerson(simpleJdbcTemplate, YODA));
|
assertEquals("Adding yoda", 1, addPerson(simpleJdbcTemplate, YODA));
|
||||||
assertEquals("Verifying the number of rows in the person table without a transaction.", 3,
|
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>
|
* <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 @Transactional}, {@link NotTransactional
|
* {@link Transactional @Transactional}, {@link NotTransactional
|
||||||
* @NotTransactional}, {@link TestExecutionListeners
|
* @NotTransactional}, {@link TestExecutionListeners
|
||||||
* @TestExecutionListeners}, and {@link ContextConfiguration
|
* @TestExecutionListeners}, and {@link ContextConfiguration
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
@ -57,7 +57,7 @@ public class DefaultRollbackFalseTransactionalSpringRunnerTests extends Abstract
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void verifyFinalTestData() {
|
public static void verifyFinalTestData() {
|
||||||
assertEquals("Verifying the final number of rows in the person table after all tests.", 2,
|
assertEquals("Verifying the final number of rows in the person table after all tests.", 2,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
@ -65,7 +65,7 @@ public class DefaultRollbackFalseTransactionalSpringRunnerTests extends Abstract
|
||||||
clearPersonTable(simpleJdbcTemplate);
|
clearPersonTable(simpleJdbcTemplate);
|
||||||
assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB));
|
assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB));
|
||||||
assertEquals("Verifying the initial number of rows in the person table.", 1,
|
assertEquals("Verifying the initial number of rows in the person table.", 1,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -75,7 +75,7 @@ public class DefaultRollbackFalseTransactionalSpringRunnerTests extends Abstract
|
||||||
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
||||||
assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE));
|
assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE));
|
||||||
assertEquals("Verifying the number of rows in the person table within a transaction.", 2,
|
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.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)
|
||||||
|
|
@ -54,7 +54,7 @@ public class DefaultRollbackTrueTransactionalSpringRunnerTests extends AbstractT
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void verifyFinalTestData() {
|
public static void verifyFinalTestData() {
|
||||||
assertEquals("Verifying the final number of rows in the person table after all tests.", originalNumRows,
|
assertEquals("Verifying the final number of rows in the person table after all tests.", originalNumRows,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
@ -62,7 +62,7 @@ public class DefaultRollbackTrueTransactionalSpringRunnerTests extends AbstractT
|
||||||
originalNumRows = clearPersonTable(simpleJdbcTemplate);
|
originalNumRows = clearPersonTable(simpleJdbcTemplate);
|
||||||
assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB));
|
assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB));
|
||||||
assertEquals("Verifying the initial number of rows in the person table.", 1,
|
assertEquals("Verifying the initial number of rows in the person table.", 1,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout = 1000)
|
@Test(timeout = 1000)
|
||||||
|
|
@ -72,7 +72,7 @@ public class DefaultRollbackTrueTransactionalSpringRunnerTests extends AbstractT
|
||||||
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
||||||
assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE));
|
assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE));
|
||||||
assertEquals("Verifying the number of rows in the person table within a transaction.", 3,
|
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>
|
* <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 @BeforeTransaction} and
|
* {@link BeforeTransaction @BeforeTransaction} and
|
||||||
* {@link AfterTransaction @AfterTransaction} methods can fail a test in a
|
* {@link AfterTransaction @AfterTransaction} methods can fail a test in a
|
||||||
|
|
@ -138,7 +138,7 @@ public class FailingBeforeAndAfterMethodsTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@TestExecutionListeners( {})
|
@TestExecutionListeners({})
|
||||||
public static abstract class BaseTestCase {
|
public static abstract class BaseTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -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 @Transactional}, {@link TestExecutionListeners
|
* {@link Transactional @Transactional}, {@link TestExecutionListeners
|
||||||
* @TestExecutionListeners}, and {@link ContextConfiguration
|
* @TestExecutionListeners}, and {@link ContextConfiguration
|
||||||
* @ContextConfiguration} annotations in conjunction with the
|
* @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,
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -54,7 +53,7 @@ import org.springframework.test.context.support.DependencyInjectionTestExecution
|
||||||
*/
|
*/
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
@TestExecutionListeners( { DependencyInjectionTestExecutionListener.class })
|
@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class })
|
||||||
public class ParameterizedDependencyInjectionTests {
|
public class ParameterizedDependencyInjectionTests {
|
||||||
|
|
||||||
private static final List<Employee> employees = new ArrayList<Employee>();
|
private static final List<Employee> employees = new ArrayList<Employee>();
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
@ -51,7 +51,7 @@ public class RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void verifyFinalTestData() {
|
public static void verifyFinalTestData() {
|
||||||
assertEquals("Verifying the final number of rows in the person table after all tests.", originalNumRows,
|
assertEquals("Verifying the final number of rows in the person table after all tests.", originalNumRows,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
@ -60,7 +60,7 @@ public class RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests
|
||||||
originalNumRows = clearPersonTable(simpleJdbcTemplate);
|
originalNumRows = clearPersonTable(simpleJdbcTemplate);
|
||||||
assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB));
|
assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB));
|
||||||
assertEquals("Verifying the initial number of rows in the person table.", 1,
|
assertEquals("Verifying the initial number of rows in the person table.", 1,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -72,7 +72,7 @@ public class RollbackOverrideDefaultRollbackFalseTransactionalSpringRunnerTests
|
||||||
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
||||||
assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE));
|
assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE));
|
||||||
assertEquals("Verifying the number of rows in the person table within a transaction.", 2,
|
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.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 {
|
||||||
|
|
@ -50,7 +50,7 @@ public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests e
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void verifyFinalTestData() {
|
public static void verifyFinalTestData() {
|
||||||
assertEquals("Verifying the final number of rows in the person table after all tests.", 3,
|
assertEquals("Verifying the final number of rows in the person table after all tests.", 3,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
@ -58,10 +58,9 @@ public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests e
|
||||||
clearPersonTable(simpleJdbcTemplate);
|
clearPersonTable(simpleJdbcTemplate);
|
||||||
assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB));
|
assertEquals("Adding bob", 1, addPerson(simpleJdbcTemplate, BOB));
|
||||||
assertEquals("Verifying the initial number of rows in the person table.", 1,
|
assertEquals("Verifying the initial number of rows in the person table.", 1,
|
||||||
countRowsInPersonTable(simpleJdbcTemplate));
|
countRowsInPersonTable(simpleJdbcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@Rollback(false)
|
@Rollback(false)
|
||||||
|
|
@ -70,7 +69,7 @@ public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests e
|
||||||
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
assertEquals("Adding jane", 1, addPerson(simpleJdbcTemplate, JANE));
|
||||||
assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE));
|
assertEquals("Adding sue", 1, addPerson(simpleJdbcTemplate, SUE));
|
||||||
assertEquals("Verifying the number of rows in the person table within a transaction.", 3,
|
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;
|
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
|
* {@link Transactional @Transactional} and {@link NotTransactional
|
||||||
* @NotTransactional} annotations in conjunction with {@link Timed
|
* @NotTransactional} annotations in conjunction with {@link Timed
|
||||||
* @Timed} and JUnit 4's {@link Test#timeout() timeout} attribute.
|
* @Timed} and JUnit 4's {@link Test#timeout() timeout} attribute.
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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>.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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 "context marked dirty using
|
* target="_blank">SPR-3880</a> that a "context marked dirty using
|
||||||
* {@link DirtiesContext @DirtiesContext} in [a] TestNG based test is not
|
* {@link DirtiesContext @DirtiesContext} in [a] TestNG based test is not
|
||||||
|
|
|
||||||
|
|
@ -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 @BeforeTransaction} and
|
* {@link BeforeTransaction @BeforeTransaction} and
|
||||||
* {@link AfterTransaction @AfterTransaction} methods can fail a test in a
|
* {@link AfterTransaction @AfterTransaction} methods can fail a test in a
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue