@Test
  public void testHasPermissionProjectUserHasPermission() {
    projectManagerMock.expectAndReturn(
        "getProjectObj",
        P.args(
            P.eq(new Long(TestProjectShareTypePermissionChecker.PROJECT_PERMISSION.getParam1()))),
        TestProjectShareTypePermissionChecker.MOCK_PROJECT);
    final ProjectManager projectManager = (ProjectManager) projectManagerMock.proxy();

    permissionManagerMock.expectAndReturn(
        "hasPermission",
        P.args(
            P.eq(Permissions.BROWSE),
            P.eq(TestProjectShareTypePermissionChecker.MOCK_PROJECT),
            P.eq(user)),
        Boolean.TRUE);
    final PermissionManager permissionManager = (PermissionManager) permissionManagerMock.proxy();

    final ShareTypePermissionChecker checker =
        new ProjectShareTypePermissionChecker(projectManager, permissionManager, null);
    assertTrue(
        checker.hasPermission(user, TestProjectShareTypePermissionChecker.PROJECT_PERMISSION));

    projectManagerMock.verify();
    permissionManagerMock.verify();
  }
  @Test
  public void testHasPermissionNoProject() {
    projectManagerMock.expectAndReturn(
        "getProjectObj",
        P.args(
            P.eq(new Long(TestProjectShareTypePermissionChecker.PROJECT_PERMISSION.getParam1()))),
        null);
    final ProjectManager projectManager = (ProjectManager) projectManagerMock.proxy();

    final ShareTypePermissionChecker checker =
        new ProjectShareTypePermissionChecker(projectManager, null, null);
    assertFalse(
        checker.hasPermission(user, TestProjectShareTypePermissionChecker.PROJECT_PERMISSION));

    projectManagerMock.verify();
  }