### Question:
SelectiveIdentificationAuthorizationService implements IdentificationAuthorizationService { @EventHandler void onEvent(ChargingStationCreatedEvent event) { String chargingStationId = event.getChargingStationId().getId(); ChargingStation chargingStation = repository.findOne(chargingStationId); if (chargingStation == null) { repository.createOrUpdate(new ChargingStation(chargingStationId, defaultAuthorizationProviders)); } }  void setProviders(Map<String, AuthorizationProvider> providers); void setRepository(ChargingStationRepository repository); @Override IdentifyingToken validate(IdentifyingToken token, @Nullable ChargingStationId chargingStationId); void setDefaultAuthorizationProviders(String defaultAuthorizationProviders);  }### Answer:
@Test public void newChargingStationCreatedShouldCreateChargingStation() { when(chargingStationRepository.findOne(CHARGING_STATION_ID.getId())).thenReturn(null); service.onEvent(new ChargingStationCreatedEvent(CHARGING_STATION_ID, ImmutableSet.<UserIdentity>builder().add(USER_IDENTITY).build(), IDENTITY_CONTEXT)); verify(chargingStationRepository).createOrUpdate(new ChargingStation(CHARGING_STATION_ID.getId())); }
@Test public void newChargingStationCreatedShouldNotFailIfChargingStationExists() { when(chargingStationRepository.findOne(CHARGING_STATION_ID.getId())).thenReturn(chargingStation); service.onEvent(new ChargingStationCreatedEvent(CHARGING_STATION_ID, ImmutableSet.<UserIdentity>builder().add(USER_IDENTITY).build(), IDENTITY_CONTEXT)); verify(chargingStationRepository, times(0)).createOrUpdate(new ChargingStation(CHARGING_STATION_ID.getId())); }