### Question:
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();  }### Answer:
@Test public void deleteWhenAuthorTest() throws NoSuchFieldException { new FieldSetter(presenter, CommentItemPresenter.class.getDeclaredField("authorId")).set("admin"); presenter.delete(); verify(changeRequestService).deleteComment(anyString(), anyString(), anyLong(), anyLong()); }
@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()); }