private void mock(AlertDefinitionEntity definition, AlertHistoryEntity history) {
    EasyMock.expect(definition.getDefinitionName()).andReturn("definitionName").atLeastOnce();
    EasyMock.expect(history.getClusterId()).andReturn(1L).atLeastOnce();
    EasyMock.expect(history.getHostName()).andReturn(HOST).atLeastOnce();
    EasyMock.expect(history.getAlertDefinition()).andReturn(definition).atLeastOnce();
    EasyMock.expect(history.getAlertDefinitionId()).andReturn(1L).atLeastOnce();
    EasyMock.expect(history.getAlertId()).andReturn(1L).atLeastOnce();
    EasyMock.expect(history.getAlertText()).andReturn("alertText").atLeastOnce();

    EasyMock.replay(definition, history);
  }
Mocks and replays the mocked definition and history

@param definition
@param history
ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOCachedTest.java