Package org.jtalks.jcommune.plugin.api.exceptions

Examples of org.jtalks.jcommune.plugin.api.exceptions.NotFoundException


        verify(subscriptionService).toggleBranchSubscription(branch);
    }

    @Test(expectedExceptions = NotFoundException.class)
    public void testSubscribeToNonexistingTopic() throws NotFoundException {
        doThrow(new NotFoundException()).when(topicFetchService).get(id);
        controller.subscribeToTopic(id, anyString());
    }
View Full Code Here


        controller.subscribeToTopic(id, anyString());
    }

    @Test(expectedExceptions = NotFoundException.class)
    public void testUnsubscribeFromNonexistingTopic() throws NotFoundException {
        doThrow(new NotFoundException()).when(topicFetchService).get(id);
        controller.unsubscribeFromTopic(id, anyString());
    }
View Full Code Here

        controller.unsubscribeFromTopic(id, anyString());
    }

    @Test(expectedExceptions = NotFoundException.class)
    public void testSubscribeOnNonexistingBranch() throws NotFoundException {
        doThrow(new NotFoundException()).when(branchService).get(id);
        controller.subscribeToBranch(id, anyString());
    }
View Full Code Here

        controller.subscribeToBranch(id, anyString());
    }

    @Test(expectedExceptions = NotFoundException.class)
    public void testUnsubscribeFromNonexistingBranch() throws NotFoundException {
        doThrow(new NotFoundException()).when(branchService).get(id);
        controller.unsubscribeFromBranch(id, anyString());
    }
View Full Code Here

    }

    @Test(expectedExceptions = NotFoundException.class)
    public void newPmPageWithWrongUserSet() throws NotFoundException {
        when(userService.getCurrentUser()).thenReturn(JC_USER);
        doThrow(new NotFoundException()).when(userService).get(JC_USER.getId());

        controller.newPmPage(JC_USER.getId());
    }
View Full Code Here

    }

    @Test(expectedExceptions = NotFoundException.class)
    public void sendMessageWithWrongUser() throws NotFoundException {
        PrivateMessageDto dto = getPrivateMessageDto();
        doThrow(new NotFoundException()).when(pmService).
                sendMessage(anyString(), anyString(), any(JCUser.class), any(JCUser.class));
        BindingResult bindingResult = new BeanPropertyBindingResult(dto, "privateMessageDto");

        controller.sendMessage(dto, bindingResult);
    }
View Full Code Here

    }

    @Test(expectedExceptions = NotFoundException.class)
    public void cannotBeShowedPm() throws NotFoundException {
        //set expectations
        when(pmService.get(PM_ID)).thenThrow(new NotFoundException());
        //invoke the object under test
        controller.showPmPage(PM_ID);

        //check expectations
        verify(pmService).get(PM_ID);
View Full Code Here

    }

    @Test
    public void saveDraftWithWrongUser() throws NotFoundException {
        PrivateMessageDto dto = getPrivateMessageDto();
        doThrow(new NotFoundException()).when(pmService)
                .saveDraft(anyLong(), anyString(), anyString(), anyString(), any(JCUser.class));
        BindingResult bindingResult = new BeanPropertyBindingResult(dto, "privateMessageDto");

        String view = controller.saveDraft(dto, bindingResult);
View Full Code Here

        BranchPermission targetPermission = BranchPermission.CREATE_POSTS;
        BranchPermissionDto dto = createBranchPermissionDto(targetPermission);
        when(permissionManager.findBranchPermissionByMask(targetPermission.getMask())).thenReturn(targetPermission);
        when(branchService.getPermissionGroupsFor(component.getId(), dto.getBranchId(), dto.isAllowed(), targetPermission))
                .thenThrow(new NotFoundException());

        JsonResponse jsonResponse = administrationController.getGroupsForBranchPermission(dto);

        assertEquals(jsonResponse.getStatus(), JsonResponseStatus.FAIL);
    }
View Full Code Here

        dto.setNewlyAddedGroupIds(Arrays.asList(1L, 2L));
        dto.setRemovedGroupIds(Arrays.asList(1L, 2L));

        when(permissionManager.findBranchPermissionByMask(targetPermission.getMask())).thenReturn(targetPermission);
        doThrow(new NotFoundException()).when(branchService).changeBranchPermissions(anyLong(),
                eq(dto.getBranchId()), eq(dto.isAllowed()), any(PermissionChanges.class));

        JsonResponse response = administrationController.editBranchPermissions(dto);

        assertEquals(response.getStatus(), JsonResponseStatus.FAIL);
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.plugin.api.exceptions.NotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.