ExtensionFilter implements Filter { @Override public boolean filter(final Object datamodelObj) { if(datamodelObj instanceof DbArtifact){ return extension.equals( ((DbArtifact)datamodelObj).getExtension()); } return false; } ExtensionFilter(final String extension); @Override boolean filter(final Object datamodelObj); @Override Map<String, Object> moduleFilterFields(); @Override Map<String, Object> artifactFilterFields();  }
@Test public void approveNull(){ ExtensionFilter filter = new ExtensionFilter("test"); assertFalse(filter.filter(null)); filter = new ExtensionFilter("test"); assertFalse(filter.filter(null)); }
@Test public void approveArtifact(){ final DbArtifact artifact = new DbArtifact(); artifact.setExtension("extensionTest"); ExtensionFilter filter = new ExtensionFilter(artifact.getExtension()); assertTrue(filter.filter(artifact)); filter = new ExtensionFilter("test"); assertFalse(filter.filter(artifact)); }