@Test public void testFirstFixture() { ResultValidator validator = fixture .registerAnnotatedCommandHandler( new MyCommandHandler(fixture.getRepository(), fixture.getEventBus())) .given(new MyEvent("aggregateId", 1)) .when(new TestCommand("aggregateId")); validator.expectReturnValue(null); validator.expectEvents(new MyEvent("aggregateId", 2)); }
@Test public void testExpectEventsIgnoresFilteredField() { ResultValidator validator = fixture .registerAnnotatedCommandHandler( new MyCommandHandler(fixture.getRepository(), fixture.getEventBus())) .registerFieldFilter(field -> !field.getName().equals("someBytes")) .given(new MyEvent("aggregateId", 1)) .when(new TestCommand("aggregateId")); validator.expectReturnValue(null); validator.expectEvents(new MyEvent("aggregateId", 2, "ignored".getBytes())); }