@Test public void testCanSaveOutOfOrderIfFromSameEditSession() throws Exception { PageData data = somePage.getData(); long ticket = 99; long time = SaveRecorder.pageSaved(data, ticket, clock); somePage.commit(data); assertFalse(SaveRecorder.changesShouldBeMerged(time - 1, ticket, data)); }
@Test public void testTiming() throws Exception { PageData data = somePage.getData(); long savedTicket = 0; long editTicket = 1; long time = SaveRecorder.pageSaved(data, savedTicket, clock); somePage.commit(data); assertTrue(SaveRecorder.changesShouldBeMerged(time - 1, editTicket, somePage.getData())); assertFalse(SaveRecorder.changesShouldBeMerged(time + 1, editTicket, somePage.getData())); }