@Test
public void testComponent() {

	FileDefinition file = new FileDefinition( new File( "some-file" ));
	BlockComponent block = new BlockComponent( file );
	block.setName( "component" );
	Collection<ParsingError> errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 0, errors.size());
	block.setName( "_component" );
	Assert.assertEquals( 0, ParsingModelValidator.validate( block ).size());
	block.setName( "component#" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_INVALID_NAME, errors.iterator().next().getErrorCode());
	block.setName( "component name" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_INVALID_NAME, errors.iterator().next().getErrorCode());
	block.setName( "component n*me" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_INVALID_NAME, errors.iterator().next().getErrorCode());
	block.setName( ".component" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_INVALID_NAME, errors.iterator().next().getErrorCode());
	block.setName( "component." );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.PM_DOT_IS_NOT_ALLOWED, errors.iterator().next().getErrorCode());
	block.setName( "component.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_COMPONENT_NAME, errors.iterator().next().getErrorCode());
	block.setName( "component-name" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 0, errors.size());
	block.setName( "component_name" );
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 0, errors.size());
	block.setName( "name" );
	block.getInnerBlocks().add( new BlockProperty( file, ParsingConstants.PROPERTY_GRAPH_EXTENDS, "facet1" ));
	errors = ParsingModelValidator.validate( block );
	Assert.assertEquals( 0, errors.size());
	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());
}