RichFactorGroup { JsonObject asJson() { JsonObject result = new JsonObject(); for (Factor factor: factorGroup) { JsonArray values = new JsonArray(); values.add(new JsonPrimitive(factor.getValue())); result.add(factor.getType(), values); } return result; } 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 asJson() { assertThat( new RichFactorGroup(new FactorSet().add(new Factor("header", "value"))).asJson(), is(GSON.fromJson("{\"HEADER\":[\"value\"]}", JsonObject.class))); }