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

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


        assertEquals(((CodeReviewDto) response.getResult()).getId(), REVIEW_ID);
    }

    @Test(expectedExceptions = NotFoundException.class)
    public void getCodeReviewNotFound() throws NotFoundException {
        when(codeReviewService.get(REVIEW_ID)).thenThrow(new NotFoundException());

        controller.getCodeReview(REVIEW_ID);
    }
View Full Code Here


    assertViewName(mav, "redirect:/posts/" + POST_ID);
  }

    @Test(expectedExceptions = NotFoundException.class)
    public void testDeleteUnexistingPost() throws NotFoundException {
        doThrow(new NotFoundException()).when(postService).get(anyLong());
        controller.delete(POST_ID);
    }
View Full Code Here

        assertEquals(result, "redirect:/topics/" + TOPIC_ID + "?page=5#" + POST_ID);
    }

    @Test(expectedExceptions = NotFoundException.class)
    public void testRedirectToPageWithPostNotFound() throws NotFoundException {
        doThrow(new NotFoundException()).when(postService).get(anyLong());

        controller.redirectToPageWithPost(POST_ID);
    }
View Full Code Here

        assertEquals("redirect:/", viewName);
    }

    @Test
    public void testActivateAccountFail() throws Exception {
        doThrow(new NotFoundException()).when(userService).activateAccount(anyString());

        String viewName = userController.activateAccount(USER_NAME, request, response);

        assertEquals("errors/activationExpired", viewName);
    }
View Full Code Here

    @RequestMapping(value = "/pm/drafts/{pmId}/edit", method = RequestMethod.GET)
    public ModelAndView editDraftPage(@PathVariable(PM_ID) Long id) throws NotFoundException {
        PrivateMessage pm = pmService.get(id);
        if (!pm.getStatus().equals(PrivateMessageStatus.DRAFT)) {
            // todo: 404? we need something more meaninful here
            throw new NotFoundException("Edit allowed only for draft messages.");
        }
        return new ModelAndView(PM_FORM).addObject(DTO, PrivateMessageDto.getFullPmDtoFor(pm));
    }
View Full Code Here

    public JCUser getByUsername(String username) throws NotFoundException {
        JCUser user = this.getDao().getByUsername(username);
        if (user == null) {
            String msg = "JCUser [" + username + "] not found.";
            LOGGER.info(msg);
            throw new NotFoundException(msg);
        }
        return user;
    }
View Full Code Here

    public User getCommonUserByUsername(String username) throws NotFoundException {
        User user = this.getDao().getCommonUserByUsername(username);
        if (user == null) {
            String msg = "Common User [" + username + "] not found.";
            LOGGER.info(msg);
            throw new NotFoundException(msg);
        }
        return user;
    }
View Full Code Here

        JCUser user = this.getDao().getByUuid(uuid);
        if (user == null) {
            LOGGER.info("Could not activate user with UUID[{}] because it doesn't exist. Either it was removed from DB "
                    + "because too much time passed between registration and activation, or there is an error in link"
                    + ", might be possible the user searches for vulnerabilities in the forum.", uuid);
            throw new NotFoundException();
        } else if (!user.isEnabled()) {
            Group group = groupDao.getGroupByName(AdministrationGroup.USER.getName());
            user.addGroup(group);
            user.setEnabled(true);
            this.getDao().saveOrUpdate(user);
View Full Code Here

     */
    @Override
    public JCUser getByUuid(String uuid) throws NotFoundException {
        JCUser user = this.getDao().getByUuid(uuid);
        if (user == null) {
            throw new NotFoundException();
        } else {
            return user;
        }
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public T get(Long id) throws NotFoundException {
        if (!dao.isExist(id)) {
            throw new NotFoundException(String.format("Entity [%s] with id: %d not found",
                    getEntityClass().getSimpleName(), id));
        }
        return dao.get(id);
    }
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.