InboxEventFactory extends AbstractEventFactory { private Event createAddedEvent(String topic, String payload) { DiscoveryResultDTO resultDTO = deserializePayload(payload, DiscoveryResultDTO.class); return new InboxAddedEvent(topic, payload, resultDTO); } InboxEventFactory(); static InboxAddedEvent createAddedEvent(DiscoveryResult discoveryResult); static InboxRemovedEvent createRemovedEvent(DiscoveryResult discoveryResult); static InboxUpdatedEvent createUpdatedEvent(DiscoveryResult discoveryResult);  }
@Test public void inboxEventFactoryCreatesInboxAddedEventCorrectly() { InboxAddedEvent event = InboxEventFactory.createAddedEvent(DISCOVERY_RESULT); assertThat(event.getType(), is(INBOX_ADDED_EVENT_TYPE)); assertThat(event.getTopic(), is(INBOX_ADDED_EVENT_TOPIC)); assertThat(event.getPayload(), is(INBOX_ADDED_EVENT_PAYLOAD)); assertThat(event.getDiscoveryResult(), not(nullValue())); assertThat(event.getDiscoveryResult().thingUID, is(THING_UID.getAsString())); }