Polishing: suppressing warnings.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1470 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
efa98d3ff4
commit
4ec91c47c3
|
|
@ -31,15 +31,14 @@ 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.springframework.test.context.support.AbstractTestExecutionListener;
|
|
||||||
import org.springframework.core.style.ToStringCreator;
|
import org.springframework.core.style.ToStringCreator;
|
||||||
|
import org.springframework.test.context.support.AbstractTestExecutionListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JUnit 4 based unit test for {@link TestContextManager}, which verifies
|
* JUnit 4 based unit test for {@link TestContextManager}, which verifies proper
|
||||||
* proper <em>execution order</em> of registered
|
* <em>execution order</em> of registered {@link TestExecutionListener
|
||||||
* {@link TestExecutionListener TestExecutionListeners}.
|
* TestExecutionListeners}.
|
||||||
*
|
*
|
||||||
* @author Sam Brannen
|
* @author Sam Brannen
|
||||||
* @since 2.5
|
* @since 2.5
|
||||||
*/
|
*/
|
||||||
|
|
@ -58,10 +57,10 @@ public class TestContextManagerTests {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts the <em>execution order</em> of 'before' and 'after' test
|
* Asserts the <em>execution order</em> of 'before' and 'after' test method
|
||||||
* method calls on {@link TestExecutionListener listeners} registered for
|
* calls on {@link TestExecutionListener listeners} registered for the
|
||||||
* the configured {@link TestContextManager}.
|
* configured {@link TestContextManager}.
|
||||||
*
|
*
|
||||||
* @see #beforeTestMethodCalls
|
* @see #beforeTestMethodCalls
|
||||||
* @see #afterTestMethodCalls
|
* @see #afterTestMethodCalls
|
||||||
*/
|
*/
|
||||||
|
|
@ -85,9 +84,9 @@ public class TestContextManagerTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTrue("Verifying execution order of 'before' listeners' (" + usageContext + ").",
|
assertTrue("Verifying execution order of 'before' listeners' (" + usageContext + ").",
|
||||||
expectedBeforeTestMethodCalls.equals(beforeTestMethodCalls));
|
expectedBeforeTestMethodCalls.equals(beforeTestMethodCalls));
|
||||||
assertTrue("Verifying execution order of 'after' listeners' (" + usageContext + ").",
|
assertTrue("Verifying execution order of 'after' listeners' (" + usageContext + ").",
|
||||||
expectedAfterTestMethodCalls.equals(afterTestMethodCalls));
|
expectedAfterTestMethodCalls.equals(afterTestMethodCalls));
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
|
@ -104,7 +103,7 @@ public class TestContextManagerTests {
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void verifyListenerExecutionOrderAfterClass() throws Exception {
|
public static void verifyListenerExecutionOrderAfterClass() throws Exception {
|
||||||
assertExecutionOrder(Arrays.<String> asList(FIRST, SECOND, THIRD),
|
assertExecutionOrder(Arrays.<String> asList(FIRST, SECOND, THIRD),
|
||||||
Arrays.<String> asList(THIRD, SECOND, FIRST), "AfterClass");
|
Arrays.<String> asList(THIRD, SECOND, FIRST), "AfterClass");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
@ -113,10 +112,10 @@ public class TestContextManagerTests {
|
||||||
final Method testMethod = ExampleTestCase.class.getDeclaredMethod("exampleTestMethod", (Class<?>[]) null);
|
final Method testMethod = ExampleTestCase.class.getDeclaredMethod("exampleTestMethod", (Class<?>[]) null);
|
||||||
this.testContextManager = new TestContextManager(ExampleTestCase.class);
|
this.testContextManager = new TestContextManager(ExampleTestCase.class);
|
||||||
this.testContextManager.registerTestExecutionListeners(new NamedTestExecutionListener(FIRST),
|
this.testContextManager.registerTestExecutionListeners(new NamedTestExecutionListener(FIRST),
|
||||||
new NamedTestExecutionListener(SECOND), new NamedTestExecutionListener(THIRD));
|
new NamedTestExecutionListener(SECOND), new NamedTestExecutionListener(THIRD));
|
||||||
|
|
||||||
assertEquals("Verifying the number of registered TestExecutionListeners.", 6,
|
assertEquals("Verifying the number of registered TestExecutionListeners.", 6,
|
||||||
this.testContextManager.getTestExecutionListeners().size());
|
this.testContextManager.getTestExecutionListeners().size());
|
||||||
|
|
||||||
this.testContextManager.beforeTestMethod(new ExampleTestCase(), testMethod);
|
this.testContextManager.beforeTestMethod(new ExampleTestCase(), testMethod);
|
||||||
}
|
}
|
||||||
|
|
@ -124,7 +123,7 @@ public class TestContextManagerTests {
|
||||||
/**
|
/**
|
||||||
* Verifies the expected {@link TestExecutionListener}
|
* Verifies the expected {@link TestExecutionListener}
|
||||||
* <em>execution order</em> within a test method.
|
* <em>execution order</em> within a test method.
|
||||||
*
|
*
|
||||||
* @see #verifyListenerExecutionOrderAfterClass()
|
* @see #verifyListenerExecutionOrderAfterClass()
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -143,6 +142,7 @@ public class TestContextManagerTests {
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
private static class ExampleTestCase {
|
private static class ExampleTestCase {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public void exampleTestMethod() {
|
public void exampleTestMethod() {
|
||||||
assertTrue(true);
|
assertTrue(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue