DDMDataProviderInvokerImpl implements DDMDataProviderInvoker { protected DDMDataProviderResponse createDDMDataProviderErrorResponse( Exception exception) { DDMDataProviderResponse.Builder builder = DDMDataProviderResponse.Builder.newBuilder(); if (exception instanceof HystrixRuntimeException) { HystrixRuntimeException.FailureType failureType = getHystrixFailureType(exception); if (failureType == HystrixRuntimeException.FailureType.COMMAND_EXCEPTION) { builder = builder.withStatus( DDMDataProviderResponseStatus.COMMAND_EXCEPTION); } else if (failureType == HystrixRuntimeException.FailureType.SHORTCIRCUIT) { builder = builder.withStatus( DDMDataProviderResponseStatus.SHORT_CIRCUIT); } else if (failureType == HystrixRuntimeException.FailureType.TIMEOUT) { builder = builder.withStatus( DDMDataProviderResponseStatus.TIMEOUT); } } else if (exception instanceof PrincipalException) { builder = builder.withStatus( DDMDataProviderResponseStatus.UNAUTHORIZED); } else { builder = builder.withStatus( DDMDataProviderResponseStatus.UNKNOWN_ERROR); } return builder.build(); }  @Override DDMDataProviderResponse invoke(
		DDMDataProviderRequest ddmDataProviderRequest);  }
@Test public void testPrincipalException() { DDMDataProviderInvokerImpl ddmDataProviderInvokerImpl = new DDMDataProviderInvokerImpl(); DDMDataProviderResponse ddmDataProviderResponse = ddmDataProviderInvokerImpl.createDDMDataProviderErrorResponse( new PrincipalException()); Assert.assertEquals( DDMDataProviderResponseStatus.UNAUTHORIZED, ddmDataProviderResponse.getStatus()); }