GeneQuery { public static GeneQuery create(String queryTerm) { return create(queryTerm, Optional.empty(), Optional.empty()); }  abstract String queryTerm(); abstract Optional<BioentityPropertyName> category(); abstract Optional<Species> species(); static GeneQuery create(String queryTerm); static GeneQuery create(String queryTerm, BioentityPropertyName category); static GeneQuery create(String queryTerm, Species species); static GeneQuery create(String queryTerm, BioentityPropertyName category, Species species);  }
@Test void otherFieldsAreOptional() { assertThat(GeneQuery.create("foobar")) .hasFieldOrPropertyWithValue("category", Optional.empty()) .hasFieldOrPropertyWithValue("species", Optional.empty()); BioentityPropertyName randomKnownPropertyName = generateRandomKnownBioentityPropertyName(); assertThat(GeneQuery.create("foobar", randomKnownPropertyName)) .hasFieldOrPropertyWithValue("category", Optional.of(randomKnownPropertyName)) .hasFieldOrPropertyWithValue("species", Optional.empty()); assertThat(GeneQuery.create("foobar", HOMO_SAPIENS)) .hasFieldOrPropertyWithValue("category", Optional.empty()) .hasFieldOrPropertyWithValue("species", Optional.of(HOMO_SAPIENS)); }