コード例 #1
0
  @Test
  public void testExecuteQueryWithDirectOnly() {
    PermissionDAO permissionDAOMock = mock(PermissionDAO.class);
    when(permissionDAOMock.getAllForEntity(
            objectID, getUser().getId(), getQueryParameters().isFiltered(), false))
        .thenReturn(mockedPermissions);
    when(getDbFacadeMockInstance().getPermissionDao()).thenReturn(permissionDAOMock);

    assertQueryDAOCall(true);
  }
コード例 #2
0
  @Test
  public void testExecuteQueryWithoutDirectOnly() {
    VdcObjectType type = RandomUtils.instance().pickRandom(VdcObjectType.values());
    when(getQueryParameters().getVdcObjectType()).thenReturn(type);

    PermissionDAO permissionDAOMock = mock(PermissionDAO.class);
    when(permissionDAOMock.getTreeForEntity(
            objectID, type, getUser().getId(), getQueryParameters().isFiltered()))
        .thenReturn(mockedPermissions);
    when(getDbFacadeMockInstance().getPermissionDao()).thenReturn(permissionDAOMock);

    assertQueryDAOCall(false);
  }