INT-3154/INT-3137 JavaDoc Formatting
INT-3154 Use SPR Java7 stylesheet to put a box around `<pre class="code"/>` code. Update `<pre/>` tags to include class="code". INT-3137 Remove NOTICE from `JdbcChannelMessageStore`. JIRA: https://jira.springsource.org/browse/INT-3137 https://jira.springsource.org/browse/INT-3154
This commit is contained in:
committed by
Artem Bilan
parent
87988b5032
commit
970852741d
@@ -15,17 +15,18 @@
|
||||
*/
|
||||
package org.springframework.integration.test.matcher;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.junit.Assert;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.junit.Assert;
|
||||
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
|
||||
/**
|
||||
* Are the {@link MessageHeaders} of a {@link Message} containing any entry
|
||||
@@ -35,30 +36,34 @@ import static org.hamcrest.CoreMatchers.is;
|
||||
* entry:
|
||||
* <p>
|
||||
*
|
||||
* <pre>
|
||||
* ANY_HEADER_KEY = "foo";
|
||||
* ANY_HEADER_VALUE = "bar";
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* ANY_HEADER_KEY = "foo";
|
||||
* ANY_HEADER_VALUE = "bar";
|
||||
* assertThat(message, hasEntry(ANY_HEADER_KEY, ANY_HEADER_VALUE));
|
||||
* assertThat(message, hasEntry(ANY_HEADER_KEY, is(String.class)));
|
||||
* assertThat(message, hasEntry(ANY_HEADER_KEY, notNullValue()));
|
||||
* assertThat(message, hasEntry(ANY_HEADER_KEY, is(ANY_HEADER_VALUE)));
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* For multiple entries to match all:
|
||||
* <p>
|
||||
* <pre>
|
||||
* Map<String, Object> expectedInHeaderMap = new HashMap<String, Object>();
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* Map<String, Object> expectedInHeaderMap = new HashMap<String, Object>();
|
||||
* expectedInHeaderMap.put(ANY_HEADER_KEY, ANY_HEADER_VALUE);
|
||||
* expectedInHeaderMap.put(OTHER_HEADER_KEY, is(OTHER_HEADER_VALUE));
|
||||
* assertThat(message, HeaderMatcher.hasAllEntries(expectedInHeaderMap));
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* For a single key:
|
||||
* <p>
|
||||
*
|
||||
* <pre>
|
||||
* ANY_HEADER_KEY = "foo";
|
||||
* <pre class="code">
|
||||
* ANY_HEADER_KEY = "foo";
|
||||
* assertThat(message, HeaderMatcher.hasKey(ANY_HEADER_KEY));
|
||||
* </pre>
|
||||
*
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.hamcrest.core.IsEqual;
|
||||
* It is possible to match a single entry by value or matcher like this:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre class="code">
|
||||
* assertThat(map, hasEntry(SOME_KEY, is(SOME_VALUE)));
|
||||
* assertThat(map, hasEntry(SOME_KEY, is(String.class)));
|
||||
* assertThat(map, hasEntry(SOME_KEY, notNullValue()));
|
||||
@@ -43,16 +43,18 @@ import org.hamcrest.core.IsEqual;
|
||||
* It's also possible to match multiple entries in a map:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* Map<String, Object> expectedInMap = new HashMap<String, Object>();
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* Map<String, Object> expectedInMap = new HashMap<String, Object>();
|
||||
* expectedInMap.put(SOME_KEY, SOME_VALUE);
|
||||
* expectedInMap.put(OTHER_KEY, is(OTHER_VALUE));
|
||||
* assertThat(map, hasAllEntries(expectedInMap));
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>If you only need to verify the existence of a key:</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre class="code">
|
||||
* assertThat(map, hasKey(SOME_KEY));
|
||||
* </pre>
|
||||
*
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Map;
|
||||
|
||||
import org.hamcrest.Matcher;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.integration.Message;
|
||||
|
||||
/**
|
||||
@@ -38,22 +39,26 @@ import org.springframework.integration.Message;
|
||||
* With {@link Mockito#verify(Object)}:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* @Mock
|
||||
* MessageHandler handler;
|
||||
* ...
|
||||
* handler.handleMessage(message);
|
||||
* verify(handler).handleMessage(messageWithPayload(SOME_PAYLOAD));
|
||||
* verify(handler).handleMessage(messageWithPayload(is(SOME_CLASS)));
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* With {@link Mockito#when(Object)}:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* ...
|
||||
* when(channel.send(messageWithPayload(SOME_PAYLOAD))).thenReturn(true);
|
||||
* assertThat(channel.send(message), is(true));
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @author Alex Peters
|
||||
@@ -64,12 +69,12 @@ public class MockitoMessageMatchers {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Message<T> messageWithPayload(Matcher<T> payloadMatcher) {
|
||||
return (Message<T>) argThat(hasPayload(payloadMatcher));
|
||||
return argThat(hasPayload(payloadMatcher));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Message<T> messageWithPayload(T payload) {
|
||||
return (Message<T>) argThat(hasPayload(payload));
|
||||
return argThat(hasPayload(payload));
|
||||
}
|
||||
|
||||
public static Message<?> messageWithHeaderEntry(String key, Object value) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.core.IsEqual;
|
||||
import org.junit.Assert;
|
||||
|
||||
import org.springframework.integration.Message;
|
||||
|
||||
/**
|
||||
@@ -29,17 +30,20 @@ import org.springframework.integration.Message;
|
||||
* A Junit example using {@link Assert#assertThat(Object, Matcher)} could look
|
||||
* like this to test a payload value:
|
||||
* <p>
|
||||
* <pre>
|
||||
* ANY_PAYLOAD = new BigDecimal("1.123");
|
||||
* Message<BigDecimal message = MessageBuilder.withPayload(ANY_PAYLOAD).build();
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* ANY_PAYLOAD = new BigDecimal("1.123");
|
||||
* Message<BigDecimal message = MessageBuilder.withPayload(ANY_PAYLOAD).build();
|
||||
* assertThat(message, hasPayload(ANY_PAYLOjAD));
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* An example using {@link Assert#assertThat(Object, Matcher)} delegating to
|
||||
* another {@link Matcher}.
|
||||
* <p>
|
||||
* <pre>
|
||||
* ANY_PAYLOAD = new BigDecimal("1.123");
|
||||
* <pre class="code">
|
||||
* ANY_PAYLOAD = new BigDecimal("1.123");
|
||||
* assertThat(message, PayloadMatcher.hasPayload(is(BigDecimal.class)));
|
||||
* assertThat(message, PayloadMatcher.hasPayload(notNullValue()));
|
||||
* assertThat(message, not((PayloadMatcher.hasPayload(is(String.class))))); *
|
||||
|
||||
@@ -47,7 +47,7 @@ public final class SocketUtils {
|
||||
* the need to use the methods of this class multiple times from within your
|
||||
* Spring Application Context XML file using SpEL. Of course you can do:
|
||||
*
|
||||
* <pre>
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* ...port="#{T(org.springframework.integration.test.util.SocketUtils).findAvailableServerSocket(12000)}"
|
||||
* }
|
||||
@@ -57,7 +57,7 @@ public final class SocketUtils {
|
||||
* This will be acceptable for single use, but if you need to invoke the
|
||||
* methods numerous time, you may instead want to do this:
|
||||
*
|
||||
* <pre>
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* <bean id="tcpIpUtils" class="org.springframework.integration.test.util.SocketUtils" />
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user