### Question:
ConfigurationEventListener { @EventHandler protected void onEvent(UnconfiguredChargingStationBootedEvent event) { LOG.info("Handling UnconfiguredChargingStationBootedEvent"); Map<String, String> attributes = event.getAttributes(); Set<Evse> evses = domainService.getEvses(attributes.get(AttributeMapKeys.VENDOR_ID), attributes.get(AttributeMapKeys.MODEL)); if (evses != null && !evses.isEmpty()) { IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); ConfigureChargingStationCommand command = new ConfigureChargingStationCommand(event.getChargingStationId(), evses, identityContext); LOG.info("Sending configure charging station command for charging station: {}", event.getChargingStationId()); commandGateway.send(command); } else { LOG.info("No Evses found for vendor {} and model {}", attributes.get(AttributeMapKeys.VENDOR_ID), attributes.get(AttributeMapKeys.MODEL)); } }  void setCommandGateway(ConfigurationCommandGateway commandGateway); void setDomainService(DomainService domainService); void setAddOnId(String id); static final String ADD_ON_TYPE; }### Answer:
@Test public void testUnknownConfiguration() { String unknownManufacturer = "UNKNOWN"; String unknownModel = "MODEL"; when(domainService.getEvses(unknownManufacturer, unknownModel)).thenReturn(new HashSet<Evse>()); eventListener.onEvent(new UnconfiguredChargingStationBootedEvent(CHARGING_STATION_ID, PROTOCOL, getAttributes(unknownManufacturer, unknownModel), IDENTITY_CONTEXT)); verify(domainService).getEvses(unknownManufacturer, unknownModel); verify(gateway, never()).send(any(ConfigureChargingStationCommand.class)); }
@Test public void testDomainServiceReturningNull() { String unknownManufacturer = "UNKNOWN"; String unknownModel = "MODEL"; when(domainService.getEvses(unknownManufacturer, unknownModel)).thenReturn(null); eventListener.onEvent(new UnconfiguredChargingStationBootedEvent(CHARGING_STATION_ID, PROTOCOL, getAttributes(unknownManufacturer, unknownModel), IDENTITY_CONTEXT)); verify(domainService).getEvses(unknownManufacturer, unknownModel); verify(gateway, never()).send(any(ConfigureChargingStationCommand.class)); }
@Test public void testConfigurationFound() { String manufacturer = "MOTOWN"; String model = "MODEL1"; IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); when(domainService.getEvses(manufacturer, model)).thenReturn(getEvses(NUMBER_OF_EVSES)); eventListener.onEvent(new UnconfiguredChargingStationBootedEvent(CHARGING_STATION_ID, PROTOCOL, getAttributes(manufacturer, model), identityContext)); verify(domainService).getEvses(manufacturer, model); verify(gateway).send(new ConfigureChargingStationCommand(CHARGING_STATION_ID, getEvses(NUMBER_OF_EVSES), identityContext)); }