use of org.apache.ranger.common.MessageEnums in project ranger by apache.
the class TestXUserREST method test50getXAuditMapVXAuditMapNull.
@Test
public void test50getXAuditMapVXAuditMapNull() {
VXAuditMap testvXAuditMap = createVXAuditMapObj();
Mockito.when(xUserMgr.getXAuditMap(testvXAuditMap.getResourceId())).thenReturn(testvXAuditMap);
Mockito.when(restErrorUtil.createRESTException(Mockito.anyString(), (MessageEnums) Mockito.any())).thenThrow(new WebApplicationException());
thrown.expect(WebApplicationException.class);
VXAuditMap retVXAuditMap = xUserRest.getXAuditMap(testvXAuditMap.getResourceId());
assertEquals(testvXAuditMap.getId(), retVXAuditMap.getId());
assertEquals(testvXAuditMap.getClass(), retVXAuditMap.getClass());
assertNotNull(retVXAuditMap);
Mockito.verify(xUserMgr).getXAuditMap(testvXAuditMap.getResourceId());
Mockito.verify(xResourceService).readResource(null);
Mockito.verify(restErrorUtil.createRESTException(Mockito.anyString(), (MessageEnums) Mockito.any()));
}
use of org.apache.ranger.common.MessageEnums in project ranger by apache.
the class TestXUserREST method test54createXAuditMapVxResourceNull.
@Test
public void test54createXAuditMapVxResourceNull() {
VXAuditMap testvXAuditMap = createVXAuditMapObj();
testvXAuditMap.setResourceId(null);
Mockito.when(xResourceService.readResource(testvXAuditMap.getResourceId())).thenReturn(null);
Mockito.when(restErrorUtil.createRESTException(Mockito.anyString(), (MessageEnums) Mockito.any())).thenThrow(new WebApplicationException());
thrown.expect(WebApplicationException.class);
VXAuditMap retvXAuditMap = xUserRest.createXAuditMap(testvXAuditMap);
assertEquals(testvXAuditMap.getId(), retvXAuditMap.getId());
assertEquals(testvXAuditMap.getClass(), retvXAuditMap.getClass());
assertNotNull(retvXAuditMap);
Mockito.verify(xUserMgr).createXAuditMap(testvXAuditMap);
Mockito.verify(xResourceService).readResource(testvXAuditMap.getResourceId());
Mockito.verify(restErrorUtil.createRESTException(Mockito.anyString(), (MessageEnums) Mockito.any()));
}
use of org.apache.ranger.common.MessageEnums in project ranger by apache.
the class TestXUserREST method test57updateXAuditMapNull.
@Test
public void test57updateXAuditMapNull() {
VXAuditMap testvXAuditMap = createVXAuditMapObj();
Mockito.when(restErrorUtil.createRESTException(Mockito.anyString(), (MessageEnums) Mockito.any())).thenThrow(new WebApplicationException());
thrown.expect(WebApplicationException.class);
VXAuditMap retvXAuditMap = xUserRest.updateXAuditMap(testvXAuditMap);
assertNull(retvXAuditMap);
Mockito.verify(xUserMgr).updateXAuditMap(testvXAuditMap);
Mockito.verify(xResourceService).readResource(null);
Mockito.verify(restErrorUtil.createRESTException(Mockito.anyString(), (MessageEnums) Mockito.any()));
}
Aggregations