@Test
public void testReferenceFieldModelEqualsByContent() {

    EntityModel entityModelOne = new EntityModel();
    EntityModel refEntityModelOne = new EntityModel();
    refEntityModelOne.setValue(new LongFieldModel("newField", 1337L));
    entityModelOne.setValue(new ReferenceFieldModel("refEntity", refEntityModelOne));
    EntityModel entityModelTwo = new EntityModel();
    EntityModel refEntityModelTwo = new EntityModel();
    refEntityModelTwo.setValue(new LongFieldModel("newField", 1337L));
    entityModelTwo.setValue(new ReferenceFieldModel("refEntity", refEntityModelTwo));
    assertTrue(EntityUtil.areEqualByContent(entityModelOne, entityModelTwo));
    //we have to go deeper
    EntityModel refRefEntityModelOne = new EntityModel();
    refRefEntityModelOne.setValue(new BooleanFieldModel("potato", true));
    refEntityModelOne.setValue(new ReferenceFieldModel("refRefEntity", refRefEntityModelOne));
    assertFalse(EntityUtil.areEqualByContent(entityModelOne, entityModelTwo));
    refEntityModelTwo.setValue(new ReferenceFieldModel("refRefEntity", refRefEntityModelOne));
    assertTrue(EntityUtil.areEqualByContent(entityModelOne, entityModelTwo));
}