Package org.jtalks.jcommune.web.dto

Examples of org.jtalks.jcommune.web.dto.CodeReviewCommentDto


        when(bindingResult.hasErrors()).thenReturn(false);
        when(codeReviewService.addComment(anyLong(), anyInt(), anyString()))
            .thenReturn(createComment());

        JsonResponse response = controller.addComment(
                new CodeReviewCommentDto(), bindingResult, 1L);

        CodeReviewCommentDto dto = (CodeReviewCommentDto) response.getResult();

        assertEquals(response.getStatus(), JsonResponseStatus.SUCCESS);
        assertEquals(dto.getId(), COMMENT_ID);
        assertEquals(dto.getBody(), COMMENT_BODY);
        assertEquals(dto.getLineNumber(), COMMENT_LINE_NUMBER);
        assertEquals(dto.getAuthorId(), USER_ID);
        assertEquals(dto.getAuthorUsername(), USERNAME);
    }
View Full Code Here


        BindingResult bindingResult = mock(BindingResult.class);

        when(bindingResult.hasErrors()).thenReturn(true);

        FailValidationJsonResponse response = (FailValidationJsonResponse)controller
                .addComment(new CodeReviewCommentDto(), bindingResult, 1L);

        assertNotNull(response.getResult());
    }
View Full Code Here

        when(bindingResult.hasErrors()).thenReturn(false);
        when(codeReviewService.addComment(anyLong(), anyInt(), anyString()))
            .thenThrow(new NotFoundException());

        controller.addComment(new CodeReviewCommentDto(), bindingResult, 1L);
    }
View Full Code Here

        when(bindingResult.hasErrors()).thenReturn(false);
        when(codeReviewService.addComment(anyLong(), anyInt(), anyString()))
            .thenThrow(new AccessDeniedException(null));

        controller.addComment(new CodeReviewCommentDto(), bindingResult, 1L);
    }
View Full Code Here

        when(bindingResult.hasErrors()).thenReturn(false);
        when(codeReviewCommentService.updateComment(anyLong(), anyString(), anyLong()))
            .thenReturn(createComment());

        JsonResponse response = controller.editComment(
                new CodeReviewCommentDto(), bindingResult, BRANCH_ID);

        CodeReviewCommentDto dto = (CodeReviewCommentDto) response.getResult();

        assertEquals(response.getStatus(), JsonResponseStatus.SUCCESS);
        assertEquals(dto.getId(), COMMENT_ID);
        assertEquals(dto.getBody(), COMMENT_BODY);
        assertEquals(dto.getLineNumber(), COMMENT_LINE_NUMBER);
        assertEquals(dto.getAuthorId(), USER_ID);
        assertEquals(dto.getAuthorUsername(), USERNAME);
        verifyZeroInteractions(notificationService);
    }
View Full Code Here

        BindingResult bindingResult = mock(BindingResult.class);

        when(bindingResult.hasErrors()).thenReturn(true);

        FailValidationJsonResponse response = (FailValidationJsonResponse)controller
                .editComment(new CodeReviewCommentDto(), bindingResult, BRANCH_ID);

        assertNotNull(response.getResult());
    }
View Full Code Here

        when(bindingResult.hasErrors()).thenReturn(false);
        when(codeReviewCommentService.updateComment(anyLong(), anyString(), anyLong()))
            .thenThrow(new NotFoundException());

        controller.editComment(new CodeReviewCommentDto(), bindingResult, BRANCH_ID);
    }
View Full Code Here

        when(bindingResult.hasErrors()).thenReturn(false);
        when(codeReviewCommentService.updateComment(anyLong(), anyString(), anyLong()))
            .thenThrow(new AccessDeniedException(null));

        controller.editComment(new CodeReviewCommentDto(), bindingResult, BRANCH_ID);
    }
View Full Code Here

        if (bindingResult.hasErrors()) {
            return new FailValidationJsonResponse(bindingResult.getAllErrors());
        }
        CodeReviewComment addedComment = codeReviewService.addComment(
                reviewId, commentDto.getLineNumber(), commentDto.getBody());
        CodeReviewCommentDto addedCommentDto = new CodeReviewCommentDto(addedComment);
        return new JsonResponse(JsonResponseStatus.SUCCESS, addedCommentDto);
    }
View Full Code Here

        if (bindingResult.hasErrors()) {
            return new FailValidationJsonResponse(bindingResult.getAllErrors());
        }
        CodeReviewComment editedComment = codeReviewCommentService.updateComment(
                commentDto.getId(), commentDto.getBody(), branchId);
        CodeReviewCommentDto editedCommentDto = new CodeReviewCommentDto(editedComment);
        return new JsonResponse(JsonResponseStatus.SUCCESS, editedCommentDto);
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.web.dto.CodeReviewCommentDto

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.