Skip to content

Commit

Permalink
add test for CursorForward
Browse files Browse the repository at this point in the history
  • Loading branch information
koentsje committed Mar 12, 2014
1 parent 010cb27 commit 68f1e0f
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 CursorForwardTest {

private int cursorOffset = 0;

private Document testDocument = new TestDocument() {
@Override public int getCursorOffset() { return cursorOffset; }
@Override public void moveCursorTo(int offset) { cursorOffset = offset; }
};

@Test
public void testGetType() {
CursorForward cursorForward = new CursorForward("5");
Assert.assertEquals(CommandType.CURSOR_FORWARD, cursorForward.getType());
}

@Test
public void testHandle() {
CursorForward cursorForward = new CursorForward("5");
cursorOffset = 10;
cursorForward.handle(testDocument);
Assert.assertEquals(15, cursorOffset);
}


}

0 comments on commit 68f1e0f

Please sign in to comment.