@Test public void testReplay() { engine.type("test"); command.get(COMMAND).execute(); Assert.assertTrue( "TestReplay() - EraseRecordable doesn't well update buffer content", engine.getText().equals("tes")); recorder.replay(); Assert.assertTrue( "TestReplay() - EraseRecordable doesn't well update buffer content", engine.getText().equals("tes")); recorder.setRecording(); command.get(COMMAND).execute(); Assert.assertTrue( "TestReplay() - EraseRecordable doesn't well update buffer content", engine.getText().equals("te")); recorder.setRecording(); recorder.replay(); Assert.assertTrue( "TestReplay() - EraseRecordable doesn't well update buffer content", engine.getText().equals("t")); recorder.replay(); Assert.assertTrue( "TestReplay() - EraseRecordable doesn't well update buffer content", engine.getText().equals("")); }
@Before public void initialize() { selection = new Selection(); engine = new EngineImpl(selection, new ClipBoard(), new Buffer()); ihm = new IHMImpl(new IHMListener()); recorder = new RecorderImpl(); command = new HashMap<String, CommandRecordable>(); command.put("erase", new EraseRecordable(engine, ihm, recorder)); recorder.setCommand(command); // Vérification de l'initialisation Assert.assertFalse("Recorder - recording attribute doesn't false", recorder.getRecording()); }
/** * execute()<br> * Redeclared execute method of Delete Execute a command, but save the command if it's necessary */ public void execute() { if (recorder.getRecording()) { recorder.record(this); } super.execute(); }