public void testMerge() throws FileFormatException {
// Create the first file
DayProgramFile file1 = new DayProgramFile();
file1.addProgramFrame(createProgramFrame(1, 1024, 1050, "Supersendung"));
file1.addProgramFrame(createProgramFrame(3, 1050, 1100, "Spitzensendung"));
file1.addProgramFrame(createProgramFrame(5, 1212, 1400, "Laaangweilig"));
// Create the second file
DayProgramFile file2 = new DayProgramFile();
file2.addProgramFrame(createProgramFrame(2, 1050, 1100, "Spitzensendung"));
// Add a frame with the same id, but with an extra field
ProgramFrame frame = new ProgramFrame(3);
frame.addProgramField(ProgramField.create(ProgramFieldType.DESCRIPTION_TYPE, "Beschreibung"));
file2.addProgramFrame(frame);
file2.addProgramFrame(createProgramFrame(6, 1100, 1212, "Nachrichten"));
// Merge the files
file1.merge(file2);
// Create the expected file
DayProgramFile file3 = new DayProgramFile();
file3.addProgramFrame(createProgramFrame(1, 1024, 1050, "Supersendung"));
file3.addProgramFrame(createProgramFrame(2, 1050, 1100, "Spitzensendung"));
frame = createProgramFrame(3, 1050, 1100, "Spitzensendung");
frame.addProgramField(ProgramField.create(ProgramFieldType.DESCRIPTION_TYPE, "Beschreibung"));
file3.addProgramFrame(frame);
file3.addProgramFrame(createProgramFrame(5, 1212, 1400, "Laaangweilig"));
file3.addProgramFrame(createProgramFrame(6, 1100, 1212, "Nachrichten"));
// Compare the result
assertFilesAreEqual(file1, file3);
}