@Test
public void testMergeContiguousRegions() {

	FileDefinition file = new FileDefinition( new File( "some-file" ));
	FileDefinitionParser parser = new FileDefinitionParser( null, false );
	List<AbstractBlock> blocks = new ArrayList<> ();
	blocks.add( new BlockImport( file ));
	blocks.add( new BlockImport( file ));
	parser.mergeContiguousRegions( blocks );
	Assert.assertEquals( 2, blocks.size());
	blocks.clear();
	blocks.add( new BlockProperty( file ));
	blocks.add( new BlockProperty( file ));
	parser.mergeContiguousRegions( blocks );
	Assert.assertEquals( 2, blocks.size());
	blocks.clear();
	blocks.add( new BlockComment( file, "# comment 1" ));
	blocks.add( new BlockComment( file, "# comment 2" ));
	parser.mergeContiguousRegions( blocks );
	Assert.assertEquals( 1, blocks.size());
	Assert.assertEquals( AbstractBlock.COMMENT, blocks.get( 0 ).getInstructionType());
	blocks.clear();
	blocks.add( new BlockComment( file, "# comment 1" ));
	blocks.add( new BlockBlank( file, "" ));
	blocks.add( new BlockComment( file, "# comment 2" ));
	parser.mergeContiguousRegions( blocks );
	Assert.assertEquals( 3, blocks.size());
	blocks.clear();
	blocks.add( new BlockComment( file, "# comment 1" ));
	blocks.add( new BlockBlank( file, "" ));
	blocks.add( new BlockComment( file, "# comment 2" ));
	blocks.add( new BlockComment( file, "# comment 3" ));
	parser.mergeContiguousRegions( blocks );
	Assert.assertEquals( 3, blocks.size());
	Assert.assertEquals( AbstractBlock.COMMENT, blocks.get( 0 ).getInstructionType());
	Assert.assertEquals( AbstractBlock.BLANK, blocks.get( 1 ).getInstructionType());
	Assert.assertEquals( AbstractBlock.COMMENT, blocks.get( 0 ).getInstructionType());
	blocks.clear();
	blocks.add( new BlockBlank( file, "" ));
	blocks.add( new BlockBlank( file, "" ));
	parser.mergeContiguousRegions( blocks );
	Assert.assertEquals( 1, blocks.size());
	Assert.assertEquals( AbstractBlock.BLANK, blocks.get( 0 ).getInstructionType());
	blocks.clear();
	blocks.add( new BlockBlank( file, "" ));
	blocks.add( new BlockComment( file, "# comment 1" ));
	blocks.add( new BlockBlank( file, "" ));
	parser.mergeContiguousRegions( blocks );
	Assert.assertEquals( 3, blocks.size());
	blocks.clear();
	blocks.add( new BlockBlank( file, "" ));
	blocks.add( new BlockBlank( file, "" ));
	blocks.add( new BlockComment( file, "# comment 1" ));
	blocks.add( new BlockBlank( file, "" ));
	parser.mergeContiguousRegions( blocks );
	Assert.assertEquals( 3, blocks.size());
	Assert.assertEquals( AbstractBlock.BLANK, blocks.get( 0 ).getInstructionType());
	Assert.assertEquals( AbstractBlock.COMMENT, blocks.get( 1 ).getInstructionType());
	Assert.assertEquals( AbstractBlock.BLANK, blocks.get( 0 ).getInstructionType());
}