我正在尝试将Junit测试用例添加到我的项目中。这是我的测试用例代码
public class COMPUTEtest<A> {
Dijkstra tester = new Dijkstra();
@Test
public void testAdd()
{
ArrayList<Vertex> metro= new ArrayList<Vertex>();
Vertex A = new Vertex("Chennai",Lane.BLACK);
Vertex B = new Vertex("Banglore",Lane.GREEN);
Vertex C = new Vertex("Hyderabad",Lane.BLUE);
Vertex D = new Vertex("Pune",Lane.RED);
Vertex E = new Vertex("Hosur",Lane.BLACK);
A.adjacencies = new Edge[]{ new Edge(B, 1) , new Edge(C, 1), new Edge(D, 2)};
B.adjacencies = new Edge[]{ new Edge(D, 1) ,new Edge(E, 2),new Edge(A, 1)};
C.adjacencies = new Edge[]{ new Edge(D, 2),new Edge(A, 1) };
D.adjacencies = new Edge[]{ new Edge(E, 2) ,new Edge(A, 2),new Edge(B, 1)};
E.adjacencies = new Edge[]{ new Edge(D, 2),new Edge(B, 2) };
List<Vertex> path=Dijkstra.getShortestPathTo(A, E);
System.out.println("Path: " + path);
}
}
当我运行测试时,这是Log cat中的错误
10-16 03:14:39.108:E / memtrack(1374):无法加载memtrack模块 (没有这样的文件或目录)10-16 03:14:39.108: E / android.os.Debug(1374):无法加载memtrack模块:-2
我正在使用Eclipse Juno,ADT 23.0 JUnit 4
答案 0 :(得分:1)
替换
public class COMPUTEtest<A> {
与
public class COMPUTEtest extends TestCase {
并导入:
import junit.framework.TestCase;