CorporateFilter implements Filter { @Override public Map<String, Object> moduleFilterFields() { final Map<String, Object> queryParams = new HashMap<String, Object>(); queryParams.put(DbModule.ORGANIZATION_DB_FIELD, organization.getName()); return queryParams; } CorporateFilter(final DbOrganization organization); @Override boolean filter(final Object datamodelObj); boolean matches(final DbModule module); boolean matches(final DbArtifact artifact); boolean matches(final DbDependency dependency); @Override Map<String, Object> moduleFilterFields(); @Override Map<String, Object> artifactFilterFields(); DBRegExp getMongoRegExp();  }
@Test public void checkMongoRegExpGenerationForModules(){ final DbOrganization organization = new DbOrganization(); organization.setName("testOrganization"); organization.getCorporateGroupIdPrefixes().add(GrapesTestUtils.CORPORATE_GROUPID_4TEST); final CorporateFilter filter = new CorporateFilter(organization); Map<String, Object> params = filter.moduleFilterFields(); assertNotNull(params); assertEquals(1, params.size()); assertEquals(DbModule.ORGANIZATION_DB_FIELD, params.keySet().iterator().next()); assertEquals(organization.getName(), params.values().iterator().next()); }