use of org.nhindirect.common.rest.exceptions.AuthorizationException in project nhin-d by DirectProject.
the class UnsecuredServiceRequestBase_handleUnauthorizedTest method testHandleUnauthorized_noHeaders_assertAuthorizationException.
@Test
public void testHandleUnauthorized_noHeaders_assertAuthorizationException() throws Exception {
MockServiceRequest req = new MockServiceRequest(null, "http://service/svc", "Test");
HttpResponse resp = mock(HttpResponse.class);
AuthorizationException ex = req.handleUnauthorized(resp);
assertEquals("Action not authorized", ex.getMessage());
}
use of org.nhindirect.common.rest.exceptions.AuthorizationException in project nhin-d by DirectProject.
the class UnsecuredServiceRequestBase_interpretResponseTest method testInterpretResponseTest_401Status_assertAuthorizationException.
@Test
public void testInterpretResponseTest_401Status_assertAuthorizationException() throws Exception {
MockServiceRequest req = new MockServiceRequest(null, "http://service/svc", "Test");
HttpResponse resp = mock(HttpResponse.class);
boolean exceptionOccured = false;
try {
req.interpretResponse(401, resp);
} catch (AuthorizationException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
Aggregations