@Test
public void testFacet() {

	FileDefinition file = new FileDefinition( new File( "some-file" ));
	BlockFacet block = new BlockFacet( file );
	block.setName( "facet" );
	Assert.assertEquals( 0, ParsingModelValidator.validate( block ).size());
	block.setName( "Facet" );
	Assert.assertEquals( 0, ParsingModelValidator.validate( block ).size());
	block.setName( "_facet" );
	Assert.assertEquals( 0, ParsingModelValidator.validate( block ).size());
	block.setName( "facet#" );
	Collection<ParsingError> errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_INVALID_NAME, errors.iterator().next().getErrorCode());
	block.setName( "facet name" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_INVALID_NAME, errors.iterator().next().getErrorCode());
	block.setName( "facet n@me" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_INVALID_NAME, errors.iterator().next().getErrorCode());
	block.setName( ".facet" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_INVALID_NAME, errors.iterator().next().getErrorCode());
	block.setName( "facet." );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_DOT_IS_NOT_ALLOWED, errors.iterator().next().getErrorCode());
	block.setName( "facet.name" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_DOT_IS_NOT_ALLOWED, errors.iterator().next().getErrorCode());
	block.setName( "" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_EMPTY_FACET_NAME, errors.iterator().next().getErrorCode());
	block.setName( "facet-name" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 0, errors.size());
	block.setName( "facet_name" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 0, errors.size());
	block.setName( "name" );
	block.getInnerBlocks().add( new BlockProperty( file, "whatever", "whatever" ));
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_PROPERTY_NOT_APPLIABLE, errors.iterator().next().getErrorCode());
}