提交 4a1a6220 编写于 作者: S Stephane Nicoll

polishing

上级 3a419872
......@@ -155,7 +155,7 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
*/
public void registerEndpoint(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory) {
Assert.notNull(endpoint, "Endpoint must be set");
Assert.notNull(endpoint.getId(), "Endpoint id must be set");
Assert.hasText(endpoint.getId(), "Endpoint id must be set");
// Factory may be null, we defer the resolution right before actually creating the container
this.endpointDescriptors.add(new JmsListenerEndpointDescriptor(endpoint, factory));
}
......
......@@ -58,6 +58,15 @@ public class JmsListenerEndpointRegistrarTests {
registrar.registerEndpoint(new SimpleJmsListenerEndpoint(), containerFactory);
}
@Test
public void registerEmptyEndpointId() {
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
endpoint.setId("");
thrown.expect(IllegalArgumentException.class);
registrar.registerEndpoint(endpoint, containerFactory);
}
@Test
public void registerNullContainerFactoryIsAllowed() throws Exception {
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册