Browse Source

Fix broken test in EnableSchedulingTests

Commit 65d163e changed the textual message of an exception thrown by
ScheduledAnnotationBeanPostProcessor.afterSingletonsInstantiated(), and
this in turn caused the withAmbiguousTaskSchedulers_andSingleTask()
method in EnableSchedulingTests to start failing (albeit only during
'Performance' builds).

This commit updates the assertion to match the current implementation of
ScheduledAnnotationBeanPostProcessor.
pull/719/head
Sam Brannen 10 years ago
parent
commit
08f3a79821
  1. 12
      spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java

12
spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -41,6 +41,7 @@ import static org.junit.Assert.*; @@ -41,6 +41,7 @@ import static org.junit.Assert.*;
* Tests use of @EnableScheduling on @Configuration classes.
*
* @author Chris Beams
* @author Sam Brannen
* @since 3.1
*/
public class EnableSchedulingTests {
@ -142,6 +143,9 @@ public class EnableSchedulingTests { @@ -142,6 +143,9 @@ public class EnableSchedulingTests {
assertThat(ex.getMessage(), startsWith("More than one TaskScheduler"));
throw ex;
}
finally {
ctx.close();
}
}
@EnableScheduling @Configuration
@ -236,6 +240,7 @@ public class EnableSchedulingTests { @@ -236,6 +240,7 @@ public class EnableSchedulingTests {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(SchedulingEnabled_withAmbiguousTaskSchedulers_butNoActualTasks.class);
ctx.refresh();
ctx.close();
}
@ -266,9 +271,12 @@ public class EnableSchedulingTests { @@ -266,9 +271,12 @@ public class EnableSchedulingTests {
try {
ctx.refresh();
} catch (IllegalStateException ex) {
assertThat(ex.getMessage(), startsWith("More than one TaskScheduler and/or"));
assertThat(ex.getMessage(), startsWith("More than one TaskScheduler exists within the context"));
throw ex;
}
finally {
ctx.close();
}
}

Loading…
Cancel
Save