Skip to content

Commit

Permalink
add test for RestoreCursorPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
koentsje committed Mar 12, 2014
1 parent 96b2a52 commit dc08bf5
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.jboss.tools.aesh.core.internal.ansi;

import org.jboss.tools.aesh.core.document.Document;
import org.jboss.tools.aesh.core.test.util.TestDocument;
import org.junit.Assert;
import org.junit.Test;

public class RestoreCursorPositionTest {

private boolean cursorRestored = false;

private Document testDocument = new TestDocument() {
@Override public void restoreCursor() { cursorRestored = true; }
};

@Test
public void testGetType() {
RestoreCursorPosition restoreCursorPosition = new RestoreCursorPosition(null);
Assert.assertEquals(
CommandType.RESTORE_CURSOR_POSITION,
restoreCursorPosition.getType());
}

@Test
public void testHandle() {
RestoreCursorPosition restoreCursorPosition = new RestoreCursorPosition(null);
Assert.assertFalse(cursorRestored);
restoreCursorPosition.handle(testDocument);
Assert.assertTrue(cursorRestored);
}

}

0 comments on commit dc08bf5

Please sign in to comment.