Added MessageStoringInterceptor (INT-264).
This commit is contained in:
@@ -20,6 +20,8 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@@ -79,4 +81,33 @@ public class SimpleMessageStoreTests {
|
||||
assertEquals(message4, store.get(4));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListWhenEmpty() {
|
||||
SimpleMessageStore store = new SimpleMessageStore(3);
|
||||
List<Message<?>> list = store.list();
|
||||
assertNotNull(list);
|
||||
assertEquals(0, list.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListWhenUnderCapacity() {
|
||||
SimpleMessageStore store = new SimpleMessageStore(3);
|
||||
store.put(1, new StringMessage("foo"));
|
||||
store.put(2, new StringMessage("bar"));
|
||||
List<Message<?>> list = store.list();
|
||||
assertEquals(2, list.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListAfterExceedingCapacity() {
|
||||
SimpleMessageStore store = new SimpleMessageStore(2);
|
||||
store.put(1, new StringMessage("foo"));
|
||||
store.put(2, new StringMessage("bar"));
|
||||
store.put(3, new StringMessage("baz"));
|
||||
List<Message<?>> list = store.list();
|
||||
assertEquals(2, list.size());
|
||||
assertEquals("bar", list.get(0).getPayload());
|
||||
assertEquals("baz", list.get(1).getPayload());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user