FirmwareEventFactory extends AbstractEventFactory { @Override protected Event createEventByType(String eventType, String topic, String payload, String source) throws Exception { if (FirmwareStatusInfoEvent.TYPE.equals(eventType)) { return createFirmwareStatusInfoEvent(topic, payload); } else if (FirmwareUpdateProgressInfoEvent.TYPE.equals(eventType)) { return createFirmwareUpdateProgressInfoEvent(topic, payload); } else if (FirmwareUpdateResultInfoEvent.TYPE.equals(eventType)) { return createFirmwareUpdateResultInfoEvent(topic, payload); } throw new IllegalArgumentException("The event type '" + eventType + "' is not supported by this factory."); } FirmwareEventFactory(); static FirmwareStatusInfoEvent createFirmwareStatusInfoEvent(FirmwareStatusInfo firmwareStatusInfo); static FirmwareUpdateProgressInfoEvent createFirmwareUpdateProgressInfoEvent(
            FirmwareUpdateProgressInfo progressInfo); static FirmwareUpdateResultInfoEvent createFirmwareUpdateResultInfoEvent(
            FirmwareUpdateResultInfo firmwareUpdateResultInfo);  }
@Test public void testCreateEventForUnknownType() throws Exception { assertThrows(IllegalArgumentException.class, () -> eventFactory.createEventByType("unknownType", "topic", "somePayload", "Source")); }