Search in sources :

Example 6 with FaultResponseDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseDto in project open-smart-grid-platform by OSGP.

the class BundleResponseMessageProcessorTest method functionalExceptionDetailsAreIncludedInFaultResponse.

@Test
public void functionalExceptionDetailsAreIncludedInFaultResponse() throws Exception {
    final FunctionalExceptionType functionalException = FunctionalExceptionType.UNSUPPORTED_DEVICE_ACTION;
    final ComponentType component = ComponentType.DOMAIN_SMART_METERING;
    final String message = "No Action Value Response Object for Action Value Response DTO Object of class: org.opensmartgridplatform.dto.valueobjects.smartmetering.NonExistentResponseDto";
    final Throwable cause = new RuntimeException(message);
    final Exception exception = new FunctionalException(functionalException, component, cause);
    final FaultResponseDto faultResponse = this.processor.faultResponseForException(exception, null, this.defaultMessage);
    this.assertResponse(faultResponse, functionalException.getCode(), functionalException.name(), component.name(), cause.getClass().getName(), message, this.parameters);
}
Also used : ComponentType(org.opensmartgridplatform.shared.exceptionhandling.ComponentType) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) FaultResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseDto) FunctionalExceptionType(org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) TechnicalException(org.opensmartgridplatform.shared.exceptionhandling.TechnicalException) Test(org.junit.jupiter.api.Test)

Aggregations

FaultResponseDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseDto)6 Test (org.junit.jupiter.api.Test)5 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)4 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)4 FaultResponseParameterDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseParameterDto)3 ComponentType (org.opensmartgridplatform.shared.exceptionhandling.ComponentType)3 FunctionalExceptionType (org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType)2 ArrayList (java.util.ArrayList)1 ConnectionException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ConnectionException)1 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)1