FactorSet implements FactorGroup { @Override public Factor factorOfType(String type) { return factorsByType.get(type); } FactorSet(); private  FactorSet(Map<String, Factor> factorsByType); FactorSet add(Factor factor); @Override Iterator<Factor> iterator(); @Override Factor factorOfType(String type); @Override int compareTo(FactorGroup other); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); @Override List<Factor> without(Collection<Factor> factors); @Override FactorGroup withoutTypes(Collection<String> factorTypes); static FactorSet create(Map<String, String> factorValueByType); int size(); @Override boolean isEmpty(); @Override boolean containsOnlyOrganism(); final Map<String, Factor> factorsByType; }
@Test public void factorByTypeShouldSucceed() { assertThat(subject.factorOfType("TYPE2"), is(factorTwo)); }
@Test public void factorByTypeShouldFail() { assertThat(subject.factorOfType("type2"), is(nullValue())); assertThat(subject.factorOfType("typeX"), is(nullValue())); }