diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java index 5358336190..df65489837 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 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. @@ -57,7 +57,11 @@ public class TimedSpringRunnerTests { new SpringJUnit4ClassRunner(testClass).run(notifier); assertEquals("Verifying number of tests started for test class [" + testClass + "].", 7, listener.getTestStartedCount()); - assertEquals("Verifying number of failures for test class [" + testClass + "].", 5, + assertEquals("Verifying number of tests ignored for test class [" + testClass + "].", 0, + listener.getTestIgnoredCount()); + assertEquals("Verifying number of assumption failures for test class [" + testClass + "].", 0, + listener.getTestAssumptionFailureCount()); + assertEquals("Verifying number of test failures for test class [" + testClass + "].", 5, listener.getTestFailureCount()); assertEquals("Verifying number of tests finished for test class [" + testClass + "].", 7, listener.getTestFinishedCount()); @@ -125,7 +129,6 @@ public class TimedSpringRunnerTests { @Timed(millis = 1000) @Retention(RetentionPolicy.RUNTIME) private static @interface MetaTimedWithOverride { - long millis() default 1000; } diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/TrackingRunListener.java b/spring-test/src/test/java/org/springframework/test/context/junit4/TrackingRunListener.java index 4c257540b9..7c920abda2 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/TrackingRunListener.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/TrackingRunListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 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. @@ -37,6 +37,10 @@ public class TrackingRunListener extends RunListener { private final AtomicInteger testFinishedCount = new AtomicInteger(); + private final AtomicInteger testAssumptionFailureCount = new AtomicInteger(); + + private final AtomicInteger testIgnoredCount = new AtomicInteger(); + public int getTestFailureCount() { return this.testFailureCount.get(); @@ -50,6 +54,14 @@ public class TrackingRunListener extends RunListener { return this.testFinishedCount.get(); } + public int getTestAssumptionFailureCount() { + return this.testAssumptionFailureCount.get(); + } + + public int getTestIgnoredCount() { + return this.testIgnoredCount.get(); + } + @Override public void testFailure(Failure failure) throws Exception { this.testFailureCount.incrementAndGet(); @@ -65,4 +77,14 @@ public class TrackingRunListener extends RunListener { this.testFinishedCount.incrementAndGet(); } + @Override + public void testAssumptionFailure(Failure failure) { + this.testAssumptionFailureCount.incrementAndGet(); + } + + @Override + public void testIgnored(Description description) throws Exception { + this.testIgnoredCount.incrementAndGet(); + } + }