### Question:
InconsistencyReportReader { public void read( File file ) throws IOException { try ( BufferedReader reader = new BufferedReader( new FileReader( file ) ) ) { read( reader ); } } InconsistencyReportReader( Inconsistencies inconsistencies ); void read( File file ); void read( BufferedReader bufferedReader );  }### Answer:
@Test public void shouldReadBasicEntities() throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream( 1_000 ); FormattedLog log = FormattedLog.toOutputStream( out ); InconsistencyMessageLogger logger = new InconsistencyMessageLogger( log ); long nodeId = 5; long indexNodeId = 7; long nodeNotInTheIndexId = 17; long indexId = 99; long relationshipGroupId = 10; long relationshipId = 15; long propertyId = 20; logger.error( RecordType.NODE, new NodeRecord( nodeId ), "Some error", "something" ); logger.error( RecordType.RELATIONSHIP, new RelationshipRecord( relationshipId ), "Some error", "something" ); logger.error( RecordType.RELATIONSHIP_GROUP, new RelationshipGroupRecord( relationshipGroupId ), "Some error", "something" ); logger.error( RecordType.PROPERTY, new PropertyRecord( propertyId ), "Some error", "something" ); logger.error( RecordType.INDEX, new IndexEntry( IndexDescriptorFactory.forSchema( SchemaDescriptorFactory.forLabel( 1, 1 ) ).withId( indexNodeId ), idTokenNameLookup, 0 ), "Some index error", "Something wrong with index" ); logger.error( RecordType.NODE, new NodeRecord( nodeNotInTheIndexId ), "Some index error", IndexDescriptorFactory.forSchema( forLabel( 1, 2 ), new IndexProviderDescriptor( "key", "version" ) ).withId( indexId ).toString() ); String text = out.toString(); ReportInconsistencies inconsistencies = new ReportInconsistencies(); InconsistencyReportReader reader = new InconsistencyReportReader( inconsistencies ); reader.read( new BufferedReader( new StringReader( text ) ) ); assertTrue( inconsistencies.containsNodeId( nodeId ) ); assertTrue( inconsistencies.containsNodeId( nodeNotInTheIndexId ) ); assertTrue( inconsistencies.containsRelationshipId( relationshipId ) ); assertTrue( inconsistencies.containsRelationshipGroupId( relationshipGroupId ) ); assertTrue( inconsistencies.containsPropertyId( propertyId ) ); assertTrue( inconsistencies.containsSchemaIndexId( indexId ) ); }
@Test public void shouldParseRelationshipGroupInconsistencies() throws Exception { ReportInconsistencies inconsistencies = new ReportInconsistencies(); String text = "ERROR: The first outgoing relationship is not the first in its chain.\n" + "\tRelationshipGroup[1337,type=1,out=2,in=-1,loop=-1,prev=-1,next=3,used=true,owner=4,secondaryUnitId=-1]\n" + "ERROR: The first outgoing relationship is not the first in its chain.\n" + "\tRelationshipGroup[4242,type=1,out=2,in=-1,loop=-1,prev=-1,next=3,used=true,owner=4,secondaryUnitId=-1]\n"; InconsistencyReportReader reader = new InconsistencyReportReader( inconsistencies ); reader.read( new BufferedReader( new StringReader( text ) ) ); assertTrue( inconsistencies.containsRelationshipGroupId( 1337 ) ); assertTrue( inconsistencies.containsRelationshipGroupId( 4242 ) ); }