提交 a07ce8eb 编写于 作者: S Sam Brannen

Polishing

上级 3e2b977d
......@@ -45,7 +45,7 @@ public class AspectJCacheAnnotationTests extends AbstractCacheAnnotationTests {
}
@Override
public void testMultiEvict(CacheableService<?> service) {
protected void testMultiEvict(CacheableService<?> service) {
Object o1 = new Object();
Object r1 = service.multiCache(o1);
......
......@@ -33,12 +33,12 @@ import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
import org.springframework.tests.EnabledForTestGroups;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.concurrent.ListenableFuture;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.tests.TestGroup.PERFORMANCE;
/**
* Unit tests for {@link AnnotationAsyncExecutionAspect}.
......@@ -46,6 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Ramnivas Laddad
* @author Stephane Nicoll
*/
@EnabledForTestGroups(PERFORMANCE)
public class AnnotationAsyncExecutionAspectTests {
private static final long WAIT_TIME = 1000; //milliseconds
......@@ -57,8 +58,6 @@ public class AnnotationAsyncExecutionAspectTests {
@BeforeEach
public void setUp() {
Assume.group(TestGroup.PERFORMANCE);
executor = new CountingExecutor();
AnnotationAsyncExecutionAspect.aspectOf().setExecutor(executor);
}
......@@ -96,8 +95,6 @@ public class AnnotationAsyncExecutionAspectTests {
@Test
public void voidMethodInAsyncClassGetsRoutedAsynchronously() {
Assume.group(TestGroup.PERFORMANCE);
ClassWithAsyncAnnotation obj = new ClassWithAsyncAnnotation();
obj.increment();
executor.waitForCompletion();
......
......@@ -21,13 +21,11 @@ import javax.transaction.Transactional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.tests.transaction.CallCountingTransactionManager;
import static org.assertj.core.api.Assertions.assertThat;
......@@ -37,8 +35,7 @@ import static org.assertj.core.api.Assertions.assertThatIOException;
/**
* @author Stephane Nicoll
*/
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = JtaTransactionAspectsTests.Config.class)
@SpringJUnitConfig(JtaTransactionAspectsTests.Config.class)
public class JtaTransactionAspectsTests {
@Autowired
......
......@@ -79,7 +79,7 @@ public abstract class AbstractCacheAnnotationTests {
}
public void testCacheable(CacheableService<?> service) {
protected void testCacheable(CacheableService<?> service) {
Object o1 = new Object();
Object r1 = service.cache(o1);
......@@ -90,7 +90,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r3).isSameAs(r1);
}
public void testCacheableNull(CacheableService<?> service) {
protected void testCacheableNull(CacheableService<?> service) {
Object o1 = new Object();
assertThat(this.cm.getCache("testCache").get(o1)).isNull();
......@@ -105,7 +105,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r3).as("Cached value should be null").isNull();
}
public void testCacheableSync(CacheableService<?> service) {
protected void testCacheableSync(CacheableService<?> service) {
Object o1 = new Object();
Object r1 = service.cacheSync(o1);
......@@ -116,7 +116,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r3).isSameAs(r1);
}
public void testCacheableSyncNull(CacheableService<?> service) {
protected void testCacheableSyncNull(CacheableService<?> service) {
Object o1 = new Object();
assertThat(this.cm.getCache("testCache").get(o1)).isNull();
......@@ -131,7 +131,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r3).as("Cached value should be null").isNull();
}
public void testEvict(CacheableService<?> service, boolean successExpected) {
protected void testEvict(CacheableService<?> service, boolean successExpected) {
Cache cache = this.cm.getCache("testCache");
Object o1 = new Object();
......@@ -155,7 +155,7 @@ public abstract class AbstractCacheAnnotationTests {
}
}
public void testEvictEarly(CacheableService<?> service) {
protected void testEvictEarly(CacheableService<?> service) {
Cache cache = this.cm.getCache("testCache");
Object o1 = new Object();
......@@ -174,7 +174,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r2).isNotSameAs(r1);
}
public void testEvictException(CacheableService<?> service) {
protected void testEvictException(CacheableService<?> service) {
Object o1 = new Object();
Object r1 = service.cache(o1);
......@@ -189,7 +189,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r2).isSameAs(r1);
}
public void testEvictWithKey(CacheableService<?> service) {
protected void testEvictWithKey(CacheableService<?> service) {
Object o1 = new Object();
Object r1 = service.cache(o1);
......@@ -198,7 +198,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r2).isNotSameAs(r1);
}
public void testEvictWithKeyEarly(CacheableService<?> service) {
protected void testEvictWithKeyEarly(CacheableService<?> service) {
Object o1 = new Object();
Object r1 = service.cache(o1);
......@@ -212,7 +212,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r2).isNotSameAs(r1);
}
public void testEvictAll(CacheableService<?> service, boolean successExpected) {
protected void testEvictAll(CacheableService<?> service, boolean successExpected) {
Cache cache = this.cm.getCache("testCache");
Object o1 = new Object();
......@@ -246,7 +246,7 @@ public abstract class AbstractCacheAnnotationTests {
}
}
public void testEvictAllEarly(CacheableService<?> service) {
protected void testEvictAllEarly(CacheableService<?> service) {
Cache cache = this.cm.getCache("testCache");
Object o1 = new Object();
......@@ -273,7 +273,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r4).isNotSameAs(r2);
}
public void testConditionalExpression(CacheableService<?> service) {
protected void testConditionalExpression(CacheableService<?> service) {
Object r1 = service.conditional(4);
Object r2 = service.conditional(4);
......@@ -285,7 +285,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r4).isSameAs(r3);
}
public void testConditionalExpressionSync(CacheableService<?> service) {
protected void testConditionalExpressionSync(CacheableService<?> service) {
Object r1 = service.conditionalSync(4);
Object r2 = service.conditionalSync(4);
......@@ -297,7 +297,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r4).isSameAs(r3);
}
public void testUnlessExpression(CacheableService<?> service) {
protected void testUnlessExpression(CacheableService<?> service) {
Cache cache = this.cm.getCache("testCache");
cache.clear();
service.unless(10);
......@@ -306,7 +306,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(cache.get(11)).isNull();
}
public void testKeyExpression(CacheableService<?> service) {
protected void testKeyExpression(CacheableService<?> service) {
Object r1 = service.key(5, 1);
Object r2 = service.key(5, 2);
......@@ -318,7 +318,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r4).isNotSameAs(r3);
}
public void testVarArgsKey(CacheableService<?> service) {
protected void testVarArgsKey(CacheableService<?> service) {
Object r1 = service.varArgsKey(1, 2, 3);
Object r2 = service.varArgsKey(1, 2, 3);
......@@ -330,8 +330,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(r4).isNotSameAs(r3);
}
public void testNullValue(CacheableService<?> service) {
protected void testNullValue(CacheableService<?> service) {
Object key = new Object();
assertThat(service.nullValue(key)).isNull();
int nr = service.nullInvocations().intValue();
......@@ -341,7 +340,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(service.nullInvocations().intValue()).isEqualTo(nr + 1);
}
public void testMethodName(CacheableService<?> service, String keyName) {
protected void testMethodName(CacheableService<?> service, String keyName) {
Object key = new Object();
Object r1 = service.name(key);
assertThat(service.name(key)).isSameAs(r1);
......@@ -350,7 +349,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(cache.get(keyName)).isNotNull();
}
public void testRootVars(CacheableService<?> service) {
protected void testRootVars(CacheableService<?> service) {
Object key = new Object();
Object r1 = service.rootVars(key);
assertThat(service.rootVars(key)).isSameAs(r1);
......@@ -360,38 +359,38 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(cache.get(expectedKey)).isNotNull();
}
public void testCheckedThrowable(CacheableService<?> service) {
protected void testCheckedThrowable(CacheableService<?> service) {
String arg = UUID.randomUUID().toString();
assertThatIOException().isThrownBy(() ->
service.throwChecked(arg))
.withMessage(arg);
}
public void testUncheckedThrowable(CacheableService<?> service) {
protected void testUncheckedThrowable(CacheableService<?> service) {
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() ->
service.throwUnchecked(1L))
.withMessage("1");
}
public void testCheckedThrowableSync(CacheableService<?> service) {
protected void testCheckedThrowableSync(CacheableService<?> service) {
String arg = UUID.randomUUID().toString();
assertThatIOException().isThrownBy(() ->
service.throwCheckedSync(arg))
.withMessage(arg);
}
public void testUncheckedThrowableSync(CacheableService<?> service) {
protected void testUncheckedThrowableSync(CacheableService<?> service) {
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() ->
service.throwUncheckedSync(1L))
.withMessage("1");
}
public void testNullArg(CacheableService<?> service) {
protected void testNullArg(CacheableService<?> service) {
Object r1 = service.cache(null);
assertThat(service.cache(null)).isSameAs(r1);
}
public void testCacheUpdate(CacheableService<?> service) {
protected void testCacheUpdate(CacheableService<?> service) {
Object o = new Object();
Cache cache = this.cm.getCache("testCache");
assertThat(cache.get(o)).isNull();
......@@ -404,7 +403,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(cache.get(o).get()).isSameAs(r2);
}
public void testConditionalCacheUpdate(CacheableService<?> service) {
protected void testConditionalCacheUpdate(CacheableService<?> service) {
Integer one = 1;
Integer three = 3;
......@@ -416,7 +415,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat((int) Integer.valueOf(cache.get(three).get().toString())).isEqualTo((int) three);
}
public void testMultiCache(CacheableService<?> service) {
protected void testMultiCache(CacheableService<?> service) {
Object o1 = new Object();
Object o2 = new Object();
......@@ -442,7 +441,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(secondary.get(o2).get()).isSameAs(r4);
}
public void testMultiEvict(CacheableService<?> service) {
protected void testMultiEvict(CacheableService<?> service) {
Object o1 = new Object();
Object o2 = o1.toString() + "A";
......@@ -472,7 +471,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(secondary.get(o1).get()).isSameAs(r4);
}
public void testMultiPut(CacheableService<?> service) {
protected void testMultiPut(CacheableService<?> service) {
Object o = 1;
Cache primary = this.cm.getCache("primary");
......@@ -492,7 +491,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(secondary.get(o).get()).isSameAs(r2);
}
public void testPutRefersToResult(CacheableService<?> service) {
protected void testPutRefersToResult(CacheableService<?> service) {
Long id = Long.MIN_VALUE;
TestEntity entity = new TestEntity();
Cache primary = this.cm.getCache("primary");
......@@ -502,7 +501,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(primary.get(id).get()).isSameAs(entity);
}
public void testMultiCacheAndEvict(CacheableService<?> service) {
protected void testMultiCacheAndEvict(CacheableService<?> service) {
String methodName = "multiCacheAndEvict";
Cache primary = this.cm.getCache("primary");
......@@ -523,7 +522,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(secondary.get(key)).isNull();
}
public void testMultiConditionalCacheAndEvict(CacheableService<?> service) {
protected void testMultiConditionalCacheAndEvict(CacheableService<?> service) {
Cache primary = this.cm.getCache("primary");
Cache secondary = this.cm.getCache("secondary");
Object key = 1;
......
......@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.MutablePropertyValues;
......@@ -64,9 +65,8 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
@Test
@Override
@Disabled("Do nothing here since super is looking for errorCodes we do NOT have in the Context")
public void messageSource() throws NoSuchMessageException {
// Do nothing here since super is looking for errorCodes we
// do NOT have in the Context
}
@Test
......
......@@ -43,44 +43,43 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
*
* @author Stephane Nicoll
*/
public abstract class AbstractJmsAnnotationDrivenTests {
abstract class AbstractJmsAnnotationDrivenTests {
@Test
public abstract void sampleConfiguration();
abstract void sampleConfiguration();
@Test
public abstract void fullConfiguration();
abstract void fullConfiguration();
@Test
public abstract void fullConfigurableConfiguration();
abstract void fullConfigurableConfiguration();
@Test
public abstract void customConfiguration();
abstract void customConfiguration();
@Test
public abstract void explicitContainerFactory();
abstract void explicitContainerFactory();
@Test
public abstract void defaultContainerFactory();
abstract void defaultContainerFactory();
@Test
public abstract void jmsHandlerMethodFactoryConfiguration() throws JMSException;
abstract void jmsHandlerMethodFactoryConfiguration() throws JMSException;
@Test
public abstract void jmsListenerIsRepeatable();
abstract void jmsListenerIsRepeatable();
@Test
public abstract void jmsListeners();
abstract void jmsListeners();
/**
* Test for {@link SampleBean} discovery. If a factory with the default name
* is set, an endpoint will use it automatically
*/
public void testSampleConfiguration(ApplicationContext context) {
protected void testSampleConfiguration(ApplicationContext context) {
JmsListenerContainerTestFactory defaultFactory =
context.getBean("jmsListenerContainerFactory", JmsListenerContainerTestFactory.class);
JmsListenerContainerTestFactory simpleFactory =
......@@ -94,7 +93,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
* all endpoints provide a default registry. This shows that the default factory
* is only retrieved if it needs to be.
*/
public void testFullConfiguration(ApplicationContext context) {
protected void testFullConfiguration(ApplicationContext context) {
JmsListenerContainerTestFactory simpleFactory =
context.getBean("simpleFactory", JmsListenerContainerTestFactory.class);
assertThat(simpleFactory.getListenerContainers().size()).isEqualTo(1);
......@@ -117,7 +116,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
* with "myCustomEndpointId". The custom endpoint does not provide
* any factory so it's registered with the default one
*/
public void testCustomConfiguration(ApplicationContext context) {
protected void testCustomConfiguration(ApplicationContext context) {
JmsListenerContainerTestFactory defaultFactory =
context.getBean("jmsListenerContainerFactory", JmsListenerContainerTestFactory.class);
JmsListenerContainerTestFactory customFactory =
......@@ -141,7 +140,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
* factory to use as a default is registered with an explicit
* default.
*/
public void testExplicitContainerFactoryConfiguration(ApplicationContext context) {
protected void testExplicitContainerFactoryConfiguration(ApplicationContext context) {
JmsListenerContainerTestFactory defaultFactory =
context.getBean("simpleFactory", JmsListenerContainerTestFactory.class);
assertThat(defaultFactory.getListenerContainers().size()).isEqualTo(1);
......@@ -151,7 +150,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
* Test for {@link DefaultBean} that does not define the container
* factory to use as a default is registered with the default name.
*/
public void testDefaultContainerFactoryConfiguration(ApplicationContext context) {
protected void testDefaultContainerFactoryConfiguration(ApplicationContext context) {
JmsListenerContainerTestFactory defaultFactory =
context.getBean("jmsListenerContainerFactory", JmsListenerContainerTestFactory.class);
assertThat(defaultFactory.getListenerContainers().size()).isEqualTo(1);
......@@ -163,7 +162,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
*
* The test should throw a {@link org.springframework.jms.listener.adapter.ListenerExecutionFailedException}
*/
public void testJmsHandlerMethodFactoryConfiguration(ApplicationContext context) throws JMSException {
protected void testJmsHandlerMethodFactoryConfiguration(ApplicationContext context) throws JMSException {
JmsListenerContainerTestFactory simpleFactory =
context.getBean("defaultFactory", JmsListenerContainerTestFactory.class);
assertThat(simpleFactory.getListenerContainers().size()).isEqualTo(1);
......@@ -180,7 +179,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
* Test for {@link JmsListenerRepeatableBean} and {@link JmsListenersBean} that validates that the
* {@code @JmsListener} annotation is repeatable and generate one specific container per annotation.
*/
public void testJmsListenerRepeatable(ApplicationContext context) {
protected void testJmsListenerRepeatable(ApplicationContext context) {
JmsListenerContainerTestFactory simpleFactory =
context.getBean("jmsListenerContainerFactory", JmsListenerContainerTestFactory.class);
assertThat(simpleFactory.getListenerContainers().size()).isEqualTo(2);
......
......@@ -32,12 +32,13 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Stephane Nicoll
* @author Sam Brannen
*/
public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenTests {
class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public void sampleConfiguration() {
void sampleConfiguration() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"annotation-driven-sample-config.xml", getClass());
testSampleConfiguration(context);
......@@ -45,7 +46,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public void fullConfiguration() {
void fullConfiguration() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"annotation-driven-full-config.xml", getClass());
testFullConfiguration(context);
......@@ -53,7 +54,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public void fullConfigurableConfiguration() {
void fullConfigurableConfiguration() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"annotation-driven-full-configurable-config.xml", getClass());
testFullConfiguration(context);
......@@ -61,7 +62,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public void customConfiguration() {
void customConfiguration() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"annotation-driven-custom-registry.xml", getClass());
testCustomConfiguration(context);
......@@ -69,7 +70,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public void explicitContainerFactory() {
void explicitContainerFactory() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"annotation-driven-custom-container-factory.xml", getClass());
testExplicitContainerFactoryConfiguration(context);
......@@ -77,7 +78,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public void defaultContainerFactory() {
void defaultContainerFactory() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"annotation-driven-default-container-factory.xml", getClass());
testDefaultContainerFactoryConfiguration(context);
......@@ -85,7 +86,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public void jmsHandlerMethodFactoryConfiguration() throws JMSException {
void jmsHandlerMethodFactoryConfiguration() throws JMSException {
ApplicationContext context = new ClassPathXmlApplicationContext(
"annotation-driven-custom-handler-method-factory.xml", getClass());
......@@ -96,7 +97,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public void jmsListenerIsRepeatable() {
void jmsListenerIsRepeatable() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"annotation-driven-jms-listener-repeatable.xml", getClass());
testJmsListenerRepeatable(context);
......@@ -104,7 +105,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public void jmsListeners() {
void jmsListeners() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"annotation-driven-jms-listeners.xml", getClass());
testJmsListenerRepeatable(context);
......
......@@ -52,11 +52,11 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Stephane Nicoll
* @author Sam Brannen
*/
public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public void sampleConfiguration() {
void sampleConfiguration() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsSampleConfig.class, SampleBean.class);
testSampleConfiguration(context);
......@@ -64,7 +64,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public void fullConfiguration() {
void fullConfiguration() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsFullConfig.class, FullBean.class);
testFullConfiguration(context);
......@@ -72,7 +72,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public void fullConfigurableConfiguration() {
void fullConfigurableConfiguration() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsFullConfigurableConfig.class, FullConfigurableBean.class);
testFullConfiguration(context);
......@@ -80,7 +80,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public void customConfiguration() {
void customConfiguration() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsCustomConfig.class, CustomBean.class);
testCustomConfiguration(context);
......@@ -88,7 +88,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public void explicitContainerFactory() {
void explicitContainerFactory() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsCustomContainerFactoryConfig.class, DefaultBean.class);
testExplicitContainerFactoryConfiguration(context);
......@@ -96,14 +96,15 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public void defaultContainerFactory() {
void defaultContainerFactory() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsDefaultContainerFactoryConfig.class, DefaultBean.class);
testDefaultContainerFactoryConfiguration(context);
}
@Test
public void containerAreStartedByDefault() {
@SuppressWarnings("resource")
void containerAreStartedByDefault() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsDefaultContainerFactoryConfig.class, DefaultBean.class);
JmsListenerContainerTestFactory factory =
......@@ -114,7 +115,8 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
}
@Test
public void containerCanBeStarterViaTheRegistry() {
@SuppressWarnings("resource")
void containerCanBeStarterViaTheRegistry() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsAutoStartupFalseConfig.class, DefaultBean.class);
JmsListenerContainerTestFactory factory =
......@@ -129,7 +131,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public void jmsHandlerMethodFactoryConfiguration() throws JMSException {
void jmsHandlerMethodFactoryConfiguration() throws JMSException {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsHandlerMethodFactoryConfig.class, ValidationBean.class);
......@@ -140,7 +142,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public void jmsListenerIsRepeatable() {
void jmsListenerIsRepeatable() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsDefaultContainerFactoryConfig.class, JmsListenerRepeatableBean.class);
testJmsListenerRepeatable(context);
......@@ -148,14 +150,14 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public void jmsListeners() {
void jmsListeners() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsDefaultContainerFactoryConfig.class, JmsListenersBean.class);
testJmsListenerRepeatable(context);
}
@Test
public void composedJmsListeners() {
void composedJmsListeners() {
try (ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsDefaultContainerFactoryConfig.class, ComposedJmsListenersBean.class)) {
JmsListenerContainerTestFactory simpleFactory = context.getBean("jmsListenerContainerFactory",
......@@ -178,7 +180,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Test
@SuppressWarnings("resource")
public void unknownFactory() {
void unknownFactory() {
// not found
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() ->
new AnnotationConfigApplicationContext(EnableJmsSampleConfig.class, CustomBean.class))
......@@ -186,7 +188,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
}
@Test
public void lazyComponent() {
void lazyComponent() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsDefaultContainerFactoryConfig.class, LazyBean.class);
JmsListenerContainerTestFactory defaultFactory =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册