### Question:
LocalAuthorization implements AuthorizationProvider { @EventHandler void onEvent(ChargingStationCreatedEvent event) { String chargingStationId = event.getChargingStationId().getId(); LocalAuthChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId); if (chargingStation == null) { chargingStationRepository.createOrUpdate(new LocalAuthChargingStation(chargingStationId)); } }  @Override IdentifyingToken validate(IdentifyingToken identifyingToken, @Nullable ChargingStationId chargingStationId); void setTokenRepository(TokenRepository tokenRepository); void setChargingStationRepository(ChargingStationRepository chargingStationRepository);  }### Answer:
@Test public void newChargingStationCreatedShouldCreateChargingStation() { when(chargingStationRepository.findOne(CHARGING_STATION_ID.getId())).thenReturn(null); localAuthorization.onEvent(new ChargingStationCreatedEvent(CHARGING_STATION_ID, ImmutableSet.<UserIdentity>builder().add(USER_IDENTITY).build(), IDENTITY_CONTEXT)); verify(chargingStationRepository).createOrUpdate(new LocalAuthChargingStation(CHARGING_STATION_ID.getId())); }
@Test public void newChargingStationCreatedShouldNotFailIfChargingStationExists() { when(chargingStationRepository.findOne(CHARGING_STATION_ID.getId())).thenReturn(new LocalAuthChargingStation(CHARGING_STATION_ID.getId())); localAuthorization.onEvent(new ChargingStationCreatedEvent(CHARGING_STATION_ID, ImmutableSet.<UserIdentity>builder().add(USER_IDENTITY).build(), IDENTITY_CONTEXT)); verify(chargingStationRepository, times(0)).createOrUpdate(new LocalAuthChargingStation(CHARGING_STATION_ID.getId())); }