SemanticQueryTerm { public static SemanticQueryTerm create(String value) { return create(value, ""); }  abstract String value(); abstract Optional<String> category(); static SemanticQueryTerm create(String value); static SemanticQueryTerm create(String value, String category); boolean hasValue(); String description(); static SemanticQueryTerm.GsonTypeAdapter getGsonTypeAdapter();  }
@Test public void termsWithoutCategory() { String randomValue = random(128); assertThat(SemanticQueryTerm.create(randomValue)) .isEqualTo(SemanticQueryTerm.create(randomValue, null)) .isEqualTo(SemanticQueryTerm.create(randomValue, "")) .isEqualTo(SemanticQueryTerm.create(randomValue, " ")) .isEqualTo(SemanticQueryTerm.create(randomValue, " \t")) .hasFieldOrPropertyWithValue("category", Optional.empty()); }
@Test public void valueCannotBeNull() { assertThatNullPointerException().isThrownBy(() -> SemanticQueryTerm.create(null, "Some category")); }