boolean works = verifier.fireAnalysis();
assertTrue( works );
VerifierReport result = verifier.getResult();
assertNotNull( result );
assertEquals( 0,
result.getBySeverity( Severity.ERROR ).size() );
Collection<VerifierMessageBase> warnings = result.getBySeverity( Severity.WARNING );
Collection<VerifierMessageBase> redundancyWarnings = new ArrayList<VerifierMessageBase>();
for ( VerifierMessageBase verifierMessageBase : warnings ) {
if ( verifierMessageBase.getMessageType().equals( MessageType.REDUNDANCY ) ) {
redundancyWarnings.add( verifierMessageBase );
}
}
assertEquals( 1,
redundancyWarnings.size() );
VerifierMessage message = (VerifierMessage) redundancyWarnings.toArray()[0];
// System.out.println( message );
assertEquals( 2,
message.getImpactedRules().size() );
assertTrue( message.getImpactedRules().values().contains( "Your First Rule" ) );
assertTrue( message.getImpactedRules().values().contains( "Your Second Rule" ) );
Cause[] causes = message.getCauses().toArray( new Cause[message.getCauses().size()] );
assertEquals( 1,
causes.length );
causes = causes[0].getCauses().toArray( new Cause[causes[0].getCauses().size()] );
assertEquals( 2,
causes.length );
causes = causes[0].getCauses().toArray( new Cause[causes[0].getCauses().size()] );
assertEquals( 1,
causes.length );
causes = causes[0].getCauses().toArray( new Cause[causes[0].getCauses().size()] );
assertEquals( 1,
causes.length );
causes = causes[0].getCauses().toArray( new Cause[causes[0].getCauses().size()] );
assertEquals( 2,
causes.length );
assertEquals( 0,
result.getBySeverity( Severity.NOTE ).size() );
}