@Test public void testImport() { FileDefinition file = new FileDefinition( new File( "some-file" )); BlockImport block = new BlockImport( file ); block.setUri( "another-file.txt" ); Assert.assertEquals( 0, ParsingModelValidator.validate( block ).size()); block.setUri( "http: Assert.assertEquals( 0, ParsingModelValidator.validate( block ).size()); block.setUri( "" ); Collection<ParsingError> errors = ParsingModelValidator.validate( block ); Assert.assertEquals( 1, errors.size()); Assert.assertEquals( ErrorCode.PM_EMPTY_IMPORT_LOCATION, errors.iterator().next().getErrorCode()); }
public static Collection<ParsingError> validate( FileDefinition definitionFile ) { Collection<ParsingError> result = new ArrayList<> (); result.addAll( definitionFile.getParsingErrors()); for( AbstractBlock block : definitionFile.getBlocks()) result.addAll( validate( block )); return result; }
ParsingModelValidator { public static Collection<ParsingError> validate( FileDefinition definitionFile ) { Collection<ParsingError> result = new ArrayList<> (); result.addAll( definitionFile.getParsingErrors()); for( AbstractBlock block : definitionFile.getBlocks()) result.addAll( validate( block )); return result; } }
ParsingModelValidator { public static Collection<ParsingError> validate( FileDefinition definitionFile ) { Collection<ParsingError> result = new ArrayList<> (); result.addAll( definitionFile.getParsingErrors()); for( AbstractBlock block : definitionFile.getBlocks()) result.addAll( validate( block )); return result; } private  ParsingModelValidator(); }
ParsingModelValidator { public static Collection<ParsingError> validate( FileDefinition definitionFile ) { Collection<ParsingError> result = new ArrayList<> (); result.addAll( definitionFile.getParsingErrors()); for( AbstractBlock block : definitionFile.getBlocks()) result.addAll( validate( block )); return result; } private  ParsingModelValidator(); static Collection<ParsingError> validate( FileDefinition definitionFile ); static Collection<ParsingError> validate( AbstractBlock block ); static Collection<ParsingError> validate( BlockImport block ); static Collection<ParsingError> validate( BlockComponent block ); static Collection<ParsingError> validate( BlockInstanceOf block ); static Collection<ParsingError> validate( BlockFacet block ); static Collection<ParsingError> validate( BlockProperty block ); static Collection<ParsingError> validate( BlockComment block ); static Collection<ParsingError> validate( BlockBlank block ); }
ParsingModelValidator { public static Collection<ParsingError> validate( FileDefinition definitionFile ) { Collection<ParsingError> result = new ArrayList<> (); result.addAll( definitionFile.getParsingErrors()); for( AbstractBlock block : definitionFile.getBlocks()) result.addAll( validate( block )); return result; } private  ParsingModelValidator(); static Collection<ParsingError> validate( FileDefinition definitionFile ); static Collection<ParsingError> validate( AbstractBlock block ); static Collection<ParsingError> validate( BlockImport block ); static Collection<ParsingError> validate( BlockComponent block ); static Collection<ParsingError> validate( BlockInstanceOf block ); static Collection<ParsingError> validate( BlockFacet block ); static Collection<ParsingError> validate( BlockProperty block ); static Collection<ParsingError> validate( BlockComment block ); static Collection<ParsingError> validate( BlockBlank block );  }