Batch { public abstract int sequence();  static Batch create(Map<String, ?> context, List<Message> batch); abstract List<Message> batch(); abstract Date sentAt(); abstract Map<String, ?> context(); abstract int sequence();  }
@Test public void sequence(TestUtils.MessageBuilderFactory factory) { Message message = factory.get().userId("userId").build(); Map<String, String> context = ImmutableMap.of("foo", "bar"); List<Message> messages = ImmutableList.of(message); Batch first = Batch.create(context, messages); Batch second = Batch.create(context, messages); assertThat(first.sequence() + 1).isEqualTo(second.sequence()); }