RichFactorGroup { public static List<String> filterOutTypesWithCommonValues(List<String> types, Iterable<FactorGroup> factorGroups) { return removeAll(types, typesWithCommonValues(factorGroups)); } RichFactorGroup(FactorGroup factorGroup); Set<OntologyTerm> getOntologyTerms(); String asUrlEncodedJson(); static Set<String> typesWithCommonValues(Iterable<FactorGroup> factorGroups); static List<String> filterOutTypesWithCommonValues(List<String> types, Iterable<FactorGroup> factorGroups); static boolean isSubgroup(FactorGroup moreSpecificGroup, FactorGroup moreGeneralGroup);  }
@Test public void factorTypesMustBeNormalized() { FactorGroup fg1 = new FactorSet().add(new Factor("type 1", "v1")).add(new Factor("type 2", "v2")); FactorGroup fg2 = new FactorSet().add(new Factor("type 1", "v1")).add(new Factor("type 2", "v3")); assertThat(RichFactorGroup.filterOutTypesWithCommonValues( ImmutableList.of("type 1", "type 2"), ImmutableList.of(fg1, fg2)), is(not(ImmutableList.of(Factor.normalize("type 2"))))); assertThat(RichFactorGroup.filterOutTypesWithCommonValues( ImmutableList.of(Factor.normalize("type 1"), Factor.normalize("type 2")), ImmutableList.of(fg1, fg2)), is(ImmutableList.of(Factor.normalize("type 2")))); }