Consistent formatting
This commit is contained in:
@@ -307,7 +307,8 @@ public class MessageListenerAdapterTests {
|
||||
try {
|
||||
adapter.onMessage(sentTextMessage, session);
|
||||
fail("expected CouldNotSendReplyException with InvalidDestinationException");
|
||||
} catch(ReplyFailureException ex) {
|
||||
}
|
||||
catch (ReplyFailureException ex) {
|
||||
assertEquals(InvalidDestinationException.class, ex.getCause().getClass());
|
||||
}
|
||||
|
||||
@@ -345,7 +346,8 @@ public class MessageListenerAdapterTests {
|
||||
try {
|
||||
adapter.onMessage(sentTextMessage, session);
|
||||
fail("expected CouldNotSendReplyException with JMSException");
|
||||
} catch(ReplyFailureException ex) {
|
||||
}
|
||||
catch (ReplyFailureException ex) {
|
||||
assertEquals(JMSException.class, ex.getCause().getClass());
|
||||
}
|
||||
|
||||
@@ -371,7 +373,8 @@ public class MessageListenerAdapterTests {
|
||||
try {
|
||||
adapter.onMessage(message, session);
|
||||
fail("expected ListenerExecutionFailedException");
|
||||
} catch(ListenerExecutionFailedException ex) { /* expected */ }
|
||||
}
|
||||
catch (ListenerExecutionFailedException ex) { /* expected */ }
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -425,7 +428,8 @@ public class MessageListenerAdapterTests {
|
||||
try {
|
||||
adapter.onMessage(sentTextMessage, session);
|
||||
fail("expected CouldNotSendReplyException with MessageConversionException");
|
||||
} catch(ReplyFailureException ex) {
|
||||
}
|
||||
catch (ReplyFailureException ex) {
|
||||
assertEquals(MessageConversionException.class, ex.getCause().getClass());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -45,7 +45,7 @@ import static org.mockito.BDDMockito.*;
|
||||
* @author Rick Evans
|
||||
* @since 18.09.2004
|
||||
*/
|
||||
public final class SimpleMessageConverterTests {
|
||||
public class SimpleMessageConverterTests {
|
||||
|
||||
@Test
|
||||
public void testStringConversion() throws JMSException {
|
||||
@@ -124,19 +124,18 @@ public final class SimpleMessageConverterTests {
|
||||
assertEquals(content, converter.fromMessage(msg));
|
||||
}
|
||||
|
||||
@Test(expected=MessageConversionException.class)
|
||||
@Test(expected = MessageConversionException.class)
|
||||
public void testToMessageThrowsExceptionIfGivenNullObjectToConvert() throws Exception {
|
||||
new SimpleMessageConverter().toMessage(null, null);
|
||||
}
|
||||
|
||||
@Test(expected=MessageConversionException.class)
|
||||
@Test(expected = MessageConversionException.class)
|
||||
public void testToMessageThrowsExceptionIfGivenIncompatibleObjectToConvert() throws Exception {
|
||||
new SimpleMessageConverter().toMessage(new Object(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage() throws JMSException {
|
||||
|
||||
Session session = mock(Session.class);
|
||||
ObjectMessage message = mock(ObjectMessage.class);
|
||||
|
||||
@@ -147,7 +146,6 @@ public final class SimpleMessageConverterTests {
|
||||
|
||||
@Test
|
||||
public void testFromMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage() throws JMSException {
|
||||
|
||||
Message message = mock(Message.class);
|
||||
|
||||
SimpleMessageConverter converter = new SimpleMessageConverter();
|
||||
@@ -157,36 +155,36 @@ public final class SimpleMessageConverterTests {
|
||||
|
||||
@Test
|
||||
public void testMapConversionWhereMapHasNonStringTypesForKeys() throws JMSException {
|
||||
|
||||
MapMessage message = mock(MapMessage.class);
|
||||
final Session session = mock(Session.class);
|
||||
Session session = mock(Session.class);
|
||||
given(session.createMapMessage()).willReturn(message);
|
||||
|
||||
final Map<Integer, String> content = new HashMap<Integer, String>(1);
|
||||
Map<Integer, String> content = new HashMap<Integer, String>(1);
|
||||
content.put(1, "value1");
|
||||
|
||||
final SimpleMessageConverter converter = new SimpleMessageConverter();
|
||||
SimpleMessageConverter converter = new SimpleMessageConverter();
|
||||
try {
|
||||
converter.toMessage(content, session);
|
||||
fail("expected MessageConversionException");
|
||||
} catch (MessageConversionException ex) { /* expected */ }
|
||||
}
|
||||
catch (MessageConversionException ex) { /* expected */ }
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMapConversionWhereMapHasNNullForKey() throws JMSException {
|
||||
|
||||
MapMessage message = mock(MapMessage.class);
|
||||
final Session session = mock(Session.class);
|
||||
Session session = mock(Session.class);
|
||||
given(session.createMapMessage()).willReturn(message);
|
||||
|
||||
final Map<Object, String> content = new HashMap<Object, String>(1);
|
||||
Map<Object, String> content = new HashMap<Object, String>(1);
|
||||
content.put(null, "value1");
|
||||
|
||||
final SimpleMessageConverter converter = new SimpleMessageConverter();
|
||||
SimpleMessageConverter converter = new SimpleMessageConverter();
|
||||
try {
|
||||
converter.toMessage(content, session);
|
||||
fail("expected MessageConversionException");
|
||||
} catch (MessageConversionException ex) { /* expected */ }
|
||||
}
|
||||
catch (MessageConversionException ex) { /* expected */ }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user