### Question:
GetVariablesRequestHandler implements OcppRequestHandler<GetVariablesRequest> { @Override public void handle(String callId, GetVariablesRequest request) { List<GetVariableResult> results = request.getGetVariableData().stream().map(data -> stationComponentsHolder.getComponent(data.getComponent().getName()) .map(stationComponent -> stationComponent.getVariable(data)) .orElse(UNKNOWN_COMPONENT)).collect(toList()); stationMessageSender.sendCallResult(callId, new GetVariablesResponse().withGetVariableResult(results)); } GetVariablesRequestHandler(StationComponentsHolder stationComponentsHolder, StationMessageSender stationMessageSender); @Override void handle(String callId, GetVariablesRequest request);  }### Answer:
@Test void verifyCallResult() { initOCPPCommCtrlComponentMock(HeartbeatIntervalVariableAccessor.NAME, String.valueOf(DEFAULT_HEARTBEAT_INTERVAL)); GetVariablesRequest getVariablesRequest = createGetVariablesRequest() .withComponent(OCPPCommCtrlrComponent.NAME) .withVariable(HeartbeatIntervalVariableAccessor.NAME) .build(); getVariablesRequestHandler.handle(DEFAULT_MESSAGE_ID, getVariablesRequest); verify(stationMessageSender).sendCallResult(anyString(), messageCaptor.capture()); GetVariablesResponse getVariablesResponse = createGetVariablesResponse() .withComponent(OCPPCommCtrlrComponent.NAME) .withVariable(HeartbeatIntervalVariableAccessor.NAME) .withAttributeStatus(GetVariableResult.AttributeStatus.ACCEPTED) .withAttributeValue(String.valueOf(DEFAULT_HEARTBEAT_INTERVAL)) .build(); GetVariableResult expectedResult = getVariablesResponse.getGetVariableResult().get(0); GetVariableResult actualResult = messageCaptor.getValue().getGetVariableResult().get(0); assertAll( () -> assertThat(actualResult.getAttributeStatus()).isEqualTo(expectedResult.getAttributeStatus()), () -> assertThat(actualResult.getComponent().getName()).isEqualTo(expectedResult.getComponent().getName()), () -> assertThat(actualResult.getVariable().getName()).isEqualTo(expectedResult.getVariable().getName()), () -> assertThat(actualResult.getAttributeValue()).isEqualTo(expectedResult.getAttributeValue()) ); }
@Test void shouldSendUnknownComponent() { GetVariablesRequest getVariablesRequest = createGetVariablesRequest() .withComponent("unknown component") .withVariable(HeartbeatIntervalVariableAccessor.NAME) .build(); getVariablesRequestHandler.handle(DEFAULT_MESSAGE_ID, getVariablesRequest); verify(stationMessageSender).sendCallResult(anyString(), messageCaptor.capture()); assertThat(messageCaptor.getValue().getGetVariableResult().get(0).getAttributeStatus()).isEqualTo(UNKNOWN_COMPONENT); }