Immutable18NModel implements I18NModel { @Override public boolean equals(final Object o) { if (this == o) return true; if (!(o instanceof Immutable18NModel)) return false; final Immutable18NModel that = (Immutable18NModel) o; return i18NModel != null ? i18NModel.equals(that.i18NModel) : that.i18NModel == null; } Immutable18NModel(final I18NModel i18NModel); @Override String getValue(final String locale); @Override void putValue(final String locale, final String value); @Override Map<String, String> getAllValues(); @Override I18NModel copy(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() throws Exception { final I18NModel m1 = new Immutable18NModel(new NonI18NModel("Some text")); final I18NModel m2 = new Immutable18NModel(new NonI18NModel("Some text")); assertTrue(m1.equals(m2)); assertTrue(m2.equals(m1)); assertEquals(m2.hashCode(), m1.hashCode()); final I18NModel m3 = new Immutable18NModel(new NonI18NModel("Some text 2")); assertFalse(m3.equals(m2)); assertFalse(m2.equals(m3)); assertNotEquals(m2.hashCode(), m3.hashCode()); }