TaskIdType id2 = new TaskIdType();
id2.setHandleId(handleId);
id2.setCreationDate(DatatypeUtil.toXmlDate(date));
TaskFileEventType t1 = new TaskFileEventType();
t1.setFilePath(fileId);
t1.setDuration(duration1);
t1.setTaskId(id1);
TaskFileEventType t2 = new TaskFileEventType();
t2.setFilePath(fileId);
t2.setDuration(duration2);
t2.setTaskId(id2);
// Check that the objects created are mergeable, if this line fails, doesn't
// mean the test has failed, just that we need to change our code to make
// sure the two objects are mergeable, for the purpose of this test:
assertTrue(merger.isMergeable(t1, t2));
// Now the real tests, call the method first:
TaskFileEventType merged = merger.merge(t1, t2);
assertNotSame(t1.getTaskId(), merged.getTaskId());
assertNotSame(t2.getTaskId(), merged.getTaskId());
// Check the parameters are not altered:
assertEquals(duration1, t1.getDuration());
assertEquals(fileId, t1.getFilePath());
assertSame(id1, t1.getTaskId());