Source:
<code>public void testProbe() { CommentServiceConfig config = newConfig(); CommentManager relationCommentManager = new CommentManagerImpl(config); DocumentModel domain = session.createDocumentModel("/", "test-domain", "Domain"); session.createDocument(domain); DocumentModel file = session.createDocumentModel("/test-domain", "anotherFile", "File"); file = session.createDocument(file); session.save(); Migrator migrator = new CommentsMigrator(); assertEquals(MIGRATION_STATE_RELATION, migrator.probeState()); <START> <END> migrateFromRelationToProperty(migrator); assertEquals(MIGRATION_STATE_PROPERTY, migrator.probeState()); DocumentModel comment = session.createDocumentModel(null, "comment", COMMENT_DOC_TYPE); comment.setPropertyValue(COMMENT_AUTHOR, session.getPrincipal().getName()); comment = relationCommentManager.createComment(file, comment); session.save(); assertEquals(MIGRATION_STATE_RELATION, migrator.probeState()); relationCommentManager.deleteComment(file, comment); session.save(); RelationManager relationManager = Framework.getService(RelationManager.class); Resource commentRes = relationManager.getResource(config.commentNamespace, comment, null); Graph graph = relationManager.getGraph(config.graphName, session); List<Statement> statementList = graph.getStatements(commentRes, null, null); graph.remove(statementList); assertEquals(MIGRATION_STATE_PROPERTY, migrator.probeState()); migrateFromPropertyToSecured(migrator); assertEquals(MIGRATION_STATE_SECURED, migrator.probeState()); }</code><technical_language>This complex understand tests leveraging @Before setup some tests don't. I design of test is shared migrator tests</technical_language>

Target:
public void testProbe() { CommentServiceConfig config = newConfig(); CommentManager relationCommentManager = new CommentManagerImpl(config); CommentManager propertyCommentManager = new PropertyCommentManager(); DocumentModel domain = session.createDocumentModel("/", "test-domain", "Domain"); session.createDocument(domain); DocumentModel file = session.createDocumentModel("/test-domain", "file1", "File"); file = session.createDocument(file); session.save(); Migrator migrator = new CommentsMigrator(); assertEquals(MIGRATION_STATE_PROPERTY, migrator.probeState()); DocumentModel comment = session.createDocumentModel(null, "comment", COMMENT_DOC_TYPE); comment.setPropertyValue(COMMENT_AUTHOR, session.getPrincipal().getName()); comment = relationCommentManager.createComment(file, comment); session.save(); assertEquals(MIGRATION_STATE_RELATION, migrator.probeState()); DocumentModel otherComment = session.createDocumentModel(null, "comment", COMMENT_DOC_TYPE); otherComment.setPropertyValue(COMMENT_PARENT_ID, file.getId()); otherComment.setPropertyValue(COMMENT_AUTHOR, session.getPrincipal().getName()); propertyCommentManager.createComment(file, otherComment); session.save(); assertEquals(MIGRATION_STATE_RELATION, migrator.probeState()); relationCommentManager.deleteComment(file, comment); session.save(); RelationManager relationManager = Framework.getService(RelationManager.class); Resource commentRes = relationManager.getResource(config.commentNamespace, comment, null); Graph graph = relationManager.getGraph(config.graphName, session); List<Statement> statementList = graph.getStatements(commentRes, null, null); graph.remove(statementList); assertEquals(MIGRATION_STATE_PROPERTY, migrator.probeState()); }