parse( source ).compilation_unit();
assertEquals( "foo",
this.parser.getPackageDescr().getName() );
assertEquals( 2,
this.parser.getPackageDescr().getImports().size() );
ImportDescr impdescr = (ImportDescr) this.parser.getPackageDescr().getImports().get( 0 );
assertEquals( "com.foo.Bar",
impdescr.getTarget() );
assertEquals( source.indexOf( "import " + impdescr.getTarget() ),
impdescr.getStartCharacter() );
assertEquals( source.indexOf( "import " + impdescr.getTarget() ) + ("import " + impdescr.getTarget()).length() - 1,
impdescr.getEndCharacter() );
impdescr = (ImportDescr) this.parser.getPackageDescr().getImports().get( 1 );
assertEquals( "com.foo.Baz",
impdescr.getTarget() );
assertEquals( source.indexOf( "import " + impdescr.getTarget() ),
impdescr.getStartCharacter() );
assertEquals( source.indexOf( "import " + impdescr.getTarget() ) + ("import " + impdescr.getTarget()).length() - 1,
impdescr.getEndCharacter() );
assertFalse( this.parser.hasErrors() );
}