LangString implements Serializable { @Override public int hashCode() { return Objects.hash(value, language); } LangString(String value);  LangString(String value, String language); String getValue(); Optional<String> getLanguage(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test void hashCodeIsEqualWhenValueAndLanguageMatch() { assertEquals(new LangString("test", "cs").hashCode(), new LangString("test", "cs").hashCode()); assertNotEquals(new LangString("test", "cs").hashCode(), new LangString("test", "en").hashCode()); assertNotEquals(new LangString("test", "cs").hashCode(), new LangString("test").hashCode()); assertEquals(new LangString("test").hashCode(), new LangString("test", null).hashCode()); }