public void testPushPop() throws Exception { int testNum = 10; ArrayList<ArrayList<ClassBox>> cb_states = new ArrayList<ArrayList<ClassBox>>(testNum); ArrayList<ArrayList<Relationship>> r_states = new ArrayList<ArrayList<Relationship>>(testNum); cb_states.forEach( c -> { c = getRandomClassBoxState(); urm.pushClassBoxesToUndo(c); }); r_states.forEach( r -> { r = getRandomRelationshipState(); urm.pushRelationshipsToUndo(r); }); // Test swap cb_states.forEach( c -> { ArrayList<ClassBox> temp = urm.popClassBoxesFromUndo(); urm.pushClassBoxesToRedo(temp); assertEquals(urm.popClassBoxesFromRedo(), temp); urm.pushClassBoxesToRedo(temp); }); cb_states.forEach( r -> { ArrayList<Relationship> temp = urm.popRelationshipsFromUndo(); urm.pushRelationshipsToRedo(temp); assertEquals(urm.popRelationshipsFromRedo(), temp); urm.pushRelationshipsToRedo(temp); }); }
@Override public void setUp() throws Exception { urm = UndoRedoManager.getInstance(); }