@Test
  public void testHashCodeAndEquals(){
    AlertHistoryEntity history1 = new AlertHistoryEntity();
    AlertHistoryEntity history2 = new AlertHistoryEntity();
    history1.setAlertId(1L);
    history2.setAlertId(2L);

    AlertCurrentEntity current1 = new AlertCurrentEntity();
    AlertCurrentEntity current2 = new AlertCurrentEntity();

    Assert.assertEquals(current1.hashCode(), current2.hashCode());
    Assert.assertTrue(Objects.equals(current1, current2));

    current1.setAlertHistory(history1);
    current2.setAlertHistory(history2);
    Assert.assertNotSame(current1.hashCode(), current2.hashCode());
    Assert.assertFalse(Objects.equals(current1, current2));

    current2.setAlertHistory(history1);
    Assert.assertEquals(current1.hashCode(), current2.hashCode());
    Assert.assertTrue(Objects.equals(current1, current2));

    current1.setAlertId(1L);
    current2.setAlertId(2L);
    Assert.assertNotSame(current1.hashCode(), current2.hashCode());
    Assert.assertFalse(Objects.equals(current1, current2));

    current2.setAlertId(1L);
    Assert.assertEquals(current1.hashCode(), current2.hashCode());
    Assert.assertTrue(Objects.equals(current1, current2));
  }
Tests {@link AlertCurrentEntity#hashCode()} and {@link AlertCurrentEntity#equals(Object)}
ambari-server/src/test/java/org/apache/ambari/server/orm/entities/AlertCurrentEntityTest.java