### Question:
ChangeAvailabilityRequestHandler implements OcppRequestHandler<ChangeAvailabilityRequest> { @Override public void handle(String callId, ChangeAvailabilityRequest request) { EvseStatus requestedEvseStatus = availabilityStateMapper.mapFrom(request.getOperationalStatus()); if (isChangeEvseAvailability(request)) { availabilityManager.changeEvseAvailability(callId, request, requestedEvseStatus); } else { availabilityManager.changeStationAvailability(callId, requestedEvseStatus); } } ChangeAvailabilityRequestHandler(AvailabilityManager availabilityManager);  ChangeAvailabilityRequestHandler(AvailabilityManager availabilityManager, AvailabilityStateMapper availabilityStateMapper); @Override void handle(String callId, ChangeAvailabilityRequest request);  }### Answer:
@Test @DisplayName("Should throw an IllegalArgumentException on invalid operational status") void shouldThrowExceptionOnInvalidOperationalStatus() { when(availabilityStateMapperMock.mapFrom(any(ChangeAvailabilityRequest.OperationalStatus.class))).thenThrow(new IllegalArgumentException("some runtime exception")); ChangeAvailabilityRequest request = new ChangeAvailabilityRequest().withEvseId(DEFAULT_EVSE_ID).withOperationalStatus(OPERATIVE); assertThrows(IllegalArgumentException.class, () -> changeAvailabilityRequestHandler.handle(DEFAULT_MESSAGE_ID, request)); }
@Test @DisplayName("Should change evse availability when evseId is not equal to 0") void shouldCallChangeEvseAvailability() { when(availabilityStateMapperMock.mapFrom(eq(OPERATIVE))).thenReturn(AVAILABLE); ChangeAvailabilityRequest request = new ChangeAvailabilityRequest().withEvseId(DEFAULT_EVSE_ID).withOperationalStatus(OPERATIVE); changeAvailabilityRequestHandler.handle(DEFAULT_MESSAGE_ID, request); verify(availabilityManagerMock).changeEvseAvailability(anyString(), any(ChangeAvailabilityRequest.class), eq(AVAILABLE)); }
@Test @DisplayName("Should change station availability when evseId is equal to 0") void shouldCallChangeStationAvailability() { when(availabilityStateMapperMock.mapFrom(eq(OPERATIVE))).thenReturn(AVAILABLE); ChangeAvailabilityRequest request = new ChangeAvailabilityRequest().withEvseId(EVSE_ID_ZERO).withOperationalStatus(OPERATIVE); changeAvailabilityRequestHandler.handle(DEFAULT_MESSAGE_ID, request); verify(availabilityManagerMock).changeStationAvailability(anyString(), eq(AVAILABLE)); }