SimpleMergeRequestManager implements MergeRequestManager { @Override public Optional<Comment> getComment(Resource commentId) { try (RepositoryConnection conn = configProvider.getRepository().getConnection()) { return getComment(commentId, conn); } }  @Override List<MergeRequest> getMergeRequests(MergeRequestFilterParams params); @Override List<MergeRequest> getMergeRequests(MergeRequestFilterParams params, RepositoryConnection conn); @Override MergeRequest createMergeRequest(MergeRequestConfig config, Resource localCatalog); @Override MergeRequest createMergeRequest(MergeRequestConfig config, Resource localCatalog,
                                           RepositoryConnection conn); @Override void addMergeRequest(MergeRequest request); @Override void addMergeRequest(MergeRequest request, RepositoryConnection conn); @Override Optional<MergeRequest> getMergeRequest(Resource requestId); @Override Optional<MergeRequest> getMergeRequest(Resource requestId, RepositoryConnection conn); @Override void updateMergeRequest(Resource requestId, MergeRequest request); @Override void updateMergeRequest(Resource requestId, MergeRequest request, RepositoryConnection conn); @Override void deleteMergeRequest(Resource requestId); @Override void deleteMergeRequest(Resource requestId, RepositoryConnection conn); @Override void acceptMergeRequest(Resource requestId, User user); @Override void acceptMergeRequest(Resource requestId, User user,  RepositoryConnection conn); @Override void deleteMergeRequestsWithRecordId(Resource recordId); @Override void deleteMergeRequestsWithRecordId(Resource recordId, RepositoryConnection conn); @Override void cleanMergeRequests(Resource recordId, Resource branchId); @Override void cleanMergeRequests(Resource recordId, Resource branchId, RepositoryConnection conn); @Override Comment createComment(Resource requestId, User user, String commentStr); @Override Comment createComment(Resource requestId, User user, String commentStr, Resource parentCommentId); @Override List<List<Comment>> getComments(Resource requestId); @Override Optional<Comment> getComment(Resource commentId); @Override Optional<Comment> getComment(Resource commentId, RepositoryConnection conn); @Override void updateComment(Resource commentId, Comment comment); @Override void deleteComment(Resource commentId); @Override void deleteCommentsWithRequestId(Resource requestId);  }
@Test public void getCommentTest() { Optional<Comment> commentOpt = manager.getComment(comment1.getResource()); assertTrue(commentOpt.isPresent()); Comment comment = commentOpt.get(); assertEquals(comment1.getModel(), comment.getModel()); verify(utilsService).optObject(eq(comment1.getResource()), any(CommentFactory.class), any(RepositoryConnection.class)); }
@Test public void getCommentDoesNotExistTest() { Optional<Comment> commentOpt = manager.getComment(DOES_NOT_EXIST_IRI); assertTrue(!commentOpt.isPresent()); verify(utilsService).optObject(eq(DOES_NOT_EXIST_IRI), any(CommentFactory.class), any(RepositoryConnection.class)); }
@Test public void getCommentWithConnTest() { try (RepositoryConnection conn = repo.getConnection()) { Optional<Comment> commentOpt = manager.getComment(comment1.getResource(), conn); assertTrue(commentOpt.isPresent()); Comment comment = commentOpt.get(); assertEquals(comment1.getModel(), comment.getModel()); verify(utilsService).optObject(eq(comment1.getResource()), any(CommentFactory.class), any(RepositoryConnection.class)); } }
@Test public void getCommentDoesNotExistWithConnTest() { try (RepositoryConnection conn = repo.getConnection()) { Optional<Comment> commentOpt = manager.getComment(DOES_NOT_EXIST_IRI, conn); assertTrue(!commentOpt.isPresent()); verify(utilsService).optObject(eq(DOES_NOT_EXIST_IRI), any(CommentFactory.class), any(RepositoryConnection.class)); } }