@Test public void deleteWhenNotAuthorTest() throws NoSuchFieldException { new FieldSetter(presenter, CommentItemPresenter.class.getDeclaredField("authorId")).set("user"); presenter.delete(); verify(changeRequestService, never()).deleteComment(anyString(), anyString(), anyLong(), anyLong()); }
public void delete() { if (isUserAuthor()) { final WorkspaceProject workspaceProject = this.libraryPlaces.getActiveWorkspace(); changeRequestService.call() .deleteComment(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), this.changeRequestId, this.commentId); } }
CommentItemPresenter { public void delete() { if (isUserAuthor()) { final WorkspaceProject workspaceProject = this.libraryPlaces.getActiveWorkspace(); changeRequestService.call() .deleteComment(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), this.changeRequestId, this.commentId); } } }
CommentItemPresenter { public void delete() { if (isUserAuthor()) { final WorkspaceProject workspaceProject = this.libraryPlaces.getActiveWorkspace(); changeRequestService.call() .deleteComment(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), this.changeRequestId, this.commentId); } } @Inject  CommentItemPresenter(final View view,
                                final DateUtils dateUtils,
                                final Caller<ChangeRequestService> changeRequestService,
                                final SessionInfo sessionInfo,
                                final LibraryPlaces libraryPlaces); }
CommentItemPresenter { public void delete() { if (isUserAuthor()) { final WorkspaceProject workspaceProject = this.libraryPlaces.getActiveWorkspace(); changeRequestService.call() .deleteComment(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), this.changeRequestId, this.commentId); } } @Inject  CommentItemPresenter(final View view,
                                final DateUtils dateUtils,
                                final Caller<ChangeRequestService> changeRequestService,
                                final SessionInfo sessionInfo,
                                final LibraryPlaces libraryPlaces); @PostConstruct void postConstruct(); void setup(final Long changeRequestId,
                      final Long commentId,
                      final String authorId,
                      final Date date,
                      final String text); View getView(); void delete(); }
CommentItemPresenter { public void delete() { if (isUserAuthor()) { final WorkspaceProject workspaceProject = this.libraryPlaces.getActiveWorkspace(); changeRequestService.call() .deleteComment(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), this.changeRequestId, this.commentId); } } @Inject  CommentItemPresenter(final View view,
                                final DateUtils dateUtils,
                                final Caller<ChangeRequestService> changeRequestService,
                                final SessionInfo sessionInfo,
                                final LibraryPlaces libraryPlaces); @PostConstruct void postConstruct(); void setup(final Long changeRequestId,
                      final Long commentId,
                      final String authorId,
                      final Date date,
                      final String text); View getView(); void delete();  }