### Question:
AcmObjectHistoryServiceImpl implements AcmObjectHistoryService { @Override public AcmObjectHistory save(AcmObjectHistory acmObjectHistory, String ipAddress) { acmObjectHistory = getAcmObjectHistoryDao().save(acmObjectHistory); getAcmObjectHistoryEventPublisher().publishCreatedEvent(acmObjectHistory, ipAddress); return acmObjectHistory; }  @Override AcmObjectHistory save(AcmObjectHistory acmObjectHistory, String ipAddress); @Override AcmObjectHistory save(String userId, String type, Object obj, Long objectId, String objectType, Date date, String ipAddress); @Override AcmObjectHistory getAcmObjectHistory(Long objectId, String objectType); AcmObjectHistoryDao getAcmObjectHistoryDao(); void setAcmObjectHistoryDao(AcmObjectHistoryDao acmObjectHistoryDao); AcmObjectHistoryEventPublisher getAcmObjectHistoryEventPublisher(); void setAcmObjectHistoryEventPublisher(AcmObjectHistoryEventPublisher acmObjectHistoryEventPublisher); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter);  }### Answer:
@Test public void testSave() { String userId = "user-id"; String type = "type"; Object obj = new Object(); Long objectId = 1L; String objectType = "object-type"; Date date = new Date(); String ipAddress = "ip-address"; AcmMarshaller converter = ObjectConverter.createJSONMarshallerForTests(); String json = converter.marshal(obj); AcmObjectHistory history = new AcmObjectHistory(); history.setId(9L); history.setUserId(userId); history.setType(type); history.setObjectId(objectId); history.setObjectType(objectType); history.setObjectString(json); history.setDate(date); Capture<AcmObjectHistory> found = new Capture<AcmObjectHistory>(); expect(mockObjectHistoryDao.save(capture(found))).andReturn(history); mockAcmObjectHistoryEventPublisher.publishCreatedEvent(history, ipAddress); expectLastCall().anyTimes(); replayAll(); AcmObjectHistory saved = acmObjectHistoryService.save(history, ipAddress); assertEquals(found.getValue().getObjectId(), saved.getObjectId()); }
@Test public void testSave_withParameters() { String userId = "user-id"; String type = "type"; Object obj = new Object(); Long objectId = 1L; String objectType = "object-type"; Date date = new Date(); String ipAddress = "ip-address"; AcmMarshaller converter = ObjectConverter.createJSONMarshallerForTests(); String json = converter.marshal(obj); AcmObjectHistory history = new AcmObjectHistory(); history.setId(9L); history.setUserId(userId); history.setType(type); history.setObjectId(objectId); history.setObjectType(objectType); history.setObjectString(json); history.setDate(date); Capture<AcmObjectHistory> found = new Capture<AcmObjectHistory>(); expect(mockObjectHistoryDao.save(capture(found))).andReturn(history); mockAcmObjectHistoryEventPublisher.publishCreatedEvent(history, ipAddress); expectLastCall().anyTimes(); replayAll(); AcmObjectHistory saved = acmObjectHistoryService.save(userId, type, obj, objectId, objectType, date, ipAddress); assertEquals(found.getValue().getObjectId(), saved.getObjectId()); }