### Question:
TxStopPointVariableAccessor extends VariableAccessor { @Override public Map<AttributeType, SetVariableValidator> getVariableValidators() { return variableValidators; } TxStopPointVariableAccessor(Station station, StationStore stationStore); @Override String getVariableName(); @Override Map<AttributeType, VariableGetter> getVariableGetters(); @Override Map<AttributeType, VariableSetter> getVariableSetters(); @Override Map<AttributeType, SetVariableValidator> getVariableValidators(); @Override List<ReportDatum> generateReportData(String componentName); @Override boolean isMutable(); void setActualValue(AttributePath attributePath, CiString.CiString1000 attributeValue); static final String NAME; }### Answer:
@Test void expectValidationToPass() { SetVariableValidator setVariableValidator = txStoptPointVariableAccessor.getVariableValidators().get(AttributeType.ACTUAL); SetVariableResult result = setVariableValidator.validate(attributePath(), TX_STOP_POINT_ATTRIBUTE); assertThat(result.getComponent().getName().toString()).isEqualTo(TRANSACTION_COMPONENT_NAME); assertThat(result.getVariable().getName().toString()).isEqualTo(TX_STOP_POINT_VARIABLE_NAME); assertThat(result.getAttributeStatus()).isEqualTo(SetVariableResult.AttributeStatus.ACCEPTED); }
@Test void expectValidationToPassEmpty() { SetVariableValidator setVariableValidator = txStoptPointVariableAccessor.getVariableValidators().get(AttributeType.ACTUAL); SetVariableResult result = setVariableValidator.validate(attributePath(), new CiString.CiString1000("")); assertThat(result.getComponent().getName().toString()).isEqualTo(TRANSACTION_COMPONENT_NAME); assertThat(result.getVariable().getName().toString()).isEqualTo(TX_STOP_POINT_VARIABLE_NAME); assertThat(result.getAttributeStatus()).isEqualTo(SetVariableResult.AttributeStatus.ACCEPTED); }
@Test void expectValidationToFailOnInvalidValues() { SetVariableValidator setVariableValidator = txStoptPointVariableAccessor.getVariableValidators().get(AttributeType.ACTUAL); CiString.CiString1000 invalidValues = new CiString.CiString1000("Authorized,Random"); SetVariableResult result = setVariableValidator.validate(attributePath(), invalidValues); assertThat(result.getAttributeStatus()).isEqualTo(SetVariableResult.AttributeStatus.INVALID_VALUE); }