@Test public void shouldTestFaultyTagOccurrences() throws Exception { Property p1 = Mockito.mock(Property.class); Property p2 = Mockito.mock(Property.class); Mockito.when(p1.getKey()).thenReturn("bodyTagOccurences"); Mockito.when(p2.getKey()).thenReturn("asdasdTagOccurences"); HtmlInfoProcessingRule rule = new HtmlInfoProcessingRule(); boolean skipOnValid = rule.shouldSkip(p1.getKey(), "whatever", "whatever", "HtmlInfo", "whatever"); boolean skipOnFaulty = rule.shouldSkip(p2.getKey(), "whatever", "whatever", "HtmlInfo", "whatever"); Assert.assertFalse(skipOnValid); Assert.assertTrue(skipOnFaulty); }
@Override public boolean shouldSkip( String property, String value, String status, String tool, String version ) { if ( tool != null && tool.equalsIgnoreCase( "HtmlInfo" ) ) { if ( property.endsWith( "rences" ) ) { int tagIndex = property.indexOf( "Tag" ); if ( tagIndex == -1 ) { return true; } String tag = property.substring( 0, tagIndex ); if ( !this.tags.contains( tag ) ) { LOG.debug( "Property {} seems to be faulty, skip", property ); return true; } } } return false; }
HtmlInfoProcessingRule implements PreProcessingRule { @Override public boolean shouldSkip( String property, String value, String status, String tool, String version ) { if ( tool != null && tool.equalsIgnoreCase( "HtmlInfo" ) ) { if ( property.endsWith( "rences" ) ) { int tagIndex = property.indexOf( "Tag" ); if ( tagIndex == -1 ) { return true; } String tag = property.substring( 0, tagIndex ); if ( !this.tags.contains( tag ) ) { LOG.debug( "Property {} seems to be faulty, skip", property ); return true; } } } return false; } }
HtmlInfoProcessingRule implements PreProcessingRule { @Override public boolean shouldSkip( String property, String value, String status, String tool, String version ) { if ( tool != null && tool.equalsIgnoreCase( "HtmlInfo" ) ) { if ( property.endsWith( "rences" ) ) { int tagIndex = property.indexOf( "Tag" ); if ( tagIndex == -1 ) { return true; } String tag = property.substring( 0, tagIndex ); if ( !this.tags.contains( tag ) ) { LOG.debug( "Property {} seems to be faulty, skip", property ); return true; } } } return false; } HtmlInfoProcessingRule(); }
HtmlInfoProcessingRule implements PreProcessingRule { @Override public boolean shouldSkip( String property, String value, String status, String tool, String version ) { if ( tool != null && tool.equalsIgnoreCase( "HtmlInfo" ) ) { if ( property.endsWith( "rences" ) ) { int tagIndex = property.indexOf( "Tag" ); if ( tagIndex == -1 ) { return true; } String tag = property.substring( 0, tagIndex ); if ( !this.tags.contains( tag ) ) { LOG.debug( "Property {} seems to be faulty, skip", property ); return true; } } } return false; } HtmlInfoProcessingRule(); @Override int getPriority(); @Override boolean shouldSkip( String property, String value, String status, String tool, String version ); }
HtmlInfoProcessingRule implements PreProcessingRule { @Override public boolean shouldSkip( String property, String value, String status, String tool, String version ) { if ( tool != null && tool.equalsIgnoreCase( "HtmlInfo" ) ) { if ( property.endsWith( "rences" ) ) { int tagIndex = property.indexOf( "Tag" ); if ( tagIndex == -1 ) { return true; } String tag = property.substring( 0, tagIndex ); if ( !this.tags.contains( tag ) ) { LOG.debug( "Property {} seems to be faulty, skip", property ); return true; } } } return false; } HtmlInfoProcessingRule(); @Override int getPriority(); @Override boolean shouldSkip( String property, String value, String status, String tool, String version );  }