@Test
public void testMerge() throws Exception {

    Flow flow = createFlow("blah");
    Date timestamp = flow.getCreationTime();
    flowRepository.persist(flow);
    Long id = flow.getIdentifier();
    testTransactionManager.commitTransaction();
    testTransactionManager.beginTransaction();
    flow = flowRepository.find(id);
    FlowPart flowPart = createFlowPart("0.2");
    flowPart.setStatus(ERROR);
    flow.incrementReplayCount();
    flow.getParts().add(flowPart);
    flow.setPacket("blub".getBytes());
    testTransactionManager.commitTransaction();
    testTransactionManager.beginTransaction();
    flow = flowRepository.find(id);
    assertEquals(ERROR, flow.getStatus());
    assertEquals(1, flow.getReplayCount());
    assertEquals(timestamp, flow.getCreationTime());
    assertEquals("blub", new String(flow.getPacket()));
    assertNotNull(flow.getPart("0.2", ERROR));
}