use of org.forgerock.json.resource.DeleteRequest in project OpenAM by OpenRock.
the class UmaEnabledFilterTest method testFilterDelete.
@Test(dataProvider = "factories")
public void testFilterDelete(UmaProviderSettingsFactory factory, boolean expectFailure) throws Exception {
// Given
UmaEnabledFilter filter = new UmaEnabledFilter(factory);
DeleteRequest request = Requests.newDeleteRequest("test");
// When
Promise<ResourceResponse, ResourceException> promise = filter.filterDelete(context, request, requestHandler);
// Then
checkResult(expectFailure, promise);
if (expectFailure) {
verifyNoMoreInteractions(requestHandler);
} else {
verify(requestHandler).handleDelete(context, request);
}
}
use of org.forgerock.json.resource.DeleteRequest in project OpenAM by OpenRock.
the class UmaPolicyResourceTest method shouldHandledFailedDeletePolicy.
@Test
@SuppressWarnings("unchecked")
public void shouldHandledFailedDeletePolicy() {
//Given
Context context = mock(Context.class);
DeleteRequest request = Requests.newDeleteRequest("/policies");
ResourceException resourceException = mock(ResourceException.class);
Promise<Void, ResourceException> promise = Promises.newExceptionPromise(resourceException);
given(policyService.deletePolicy(context, "RESOURCE_SET_UID")).willReturn(promise);
//When
Promise<ResourceResponse, ResourceException> result = policyResource.deleteInstance(context, "RESOURCE_SET_UID", request);
//Then
assertThat(result).failedWithResourceException().isEqualTo(resourceException);
}
Aggregations