@Test public void test_canCreatePage_success() { final Page contentEntityObject = new Page(); when(mockUserManager.getRemoteUsername()).thenReturn(SOME_USER1.getName()); when(mockUserAccessor.getUser(SOME_USER1.getName())).thenReturn(SOME_USER1); when(mockPermissionManager.hasPermission(SOME_USER1, Permission.EDIT, contentEntityObject)) .thenReturn(true); final boolean result = classUnderTest.canCreatePage(contentEntityObject); assertThat(result, is(true)); }
@Test public void test_canAttachFile_success() { ContentEntityObject contentEntityObject = new Page(); when(mockUserManager.getRemoteUsername()).thenReturn(SOME_USER1.getName()); when(mockUserAccessor.getUser(SOME_USER1.getName())).thenReturn(SOME_USER1); when(mockPermissionManager.hasCreatePermission( SOME_USER1, contentEntityObject, Attachment.class)) .thenReturn(true); boolean result = classUnderTest.canAttachFile(contentEntityObject); assertThat(result, is(true)); }