XDCommonResponseHelper { public RegistryResponseType createError(String message) { return createRegistryResponse(message, ErrorCodes.XDSRegistryError, CONNECT_LOCATION); }  RegistryResponseType createSuccess(); RegistryResponseType createError(String message); RegistryResponseType createError(String message, ErrorCodes code); RegistryResponseType createError(String message, ErrorCodes code, String location); RegistryResponseType createError(Throwable e); static final String CONNECT_LOCATION; }
@Test public void responseFromThrowable() { Throwable t = new Throwable("message"); t.fillInStackTrace(); XDCommonResponseHelper helper = new XDCommonResponseHelper(); RegistryResponseType response = helper.createError(t); RegistryError registryError = response.getRegistryErrorList().getRegistryError().get(0); assertEquals("message", registryError.getCodeContext()); assertEquals(XDCommonResponseHelper.ErrorCodes.XDSRegistryError.toString(), registryError.getErrorCode()); assertStackTracePresent(t, registryError); }