righttest.java

来自「实现火星车,全部由java写成」· Java 代码 · 共 45 行

JAVA
45
字号
package cn.nasa;

import junit.framework.TestCase;

public class RightTest extends TestCase {
	private Direction N, S, W, E;
	private Coordinate coordinate;
	private Right right;

	protected void setUp() throws Exception {
		super.setUp();
		right = new Right();

		N = new Direction();
		S = new Direction();
		W = new Direction();
		E = new Direction();

		N.setRight(E);
		E.setRight(S);
		S.setRight(W);
		W.setRight(N);
				
//		coordinate=new Coordinate(2,1);
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testExec() {
		right.setdirection(N);
		assertEquals(E, right.exec());
		assertEquals(S, right.exec());
		assertEquals(W, right.exec());
		assertEquals(N, right.exec());
	}
	

//	public void testSetcoordinate() {
//		right.setcoordinate(coordinate);
//	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?