我刚刚开始使用Java的编程语言,当我尝试进行Junit测试时,我无法理解为什么会出现这两个错误:
Access restriction: The method 'Assert.assertEquals(Object, Object)' is not API (restriction on required library 'C:\eclipse\plugins\org.junit_4.12.0.v201504281640\junit.jar') ConcateTest.java /TestProject/src/test line 13 Java Problem
Access restriction: The type 'Test' is not API (restriction on required library 'C:\eclipse\plugins\org.junit_4.12.0.v201504281640\junit.jar') ConcateTest.java /TestProject/src/test line 5 Java Problem
如果你想知道到目前为止我写的是什么,我就把它留在这里:
package test;
import static org.junit.Assert.*;
import org.junit.Test;
public class ConcateTest {
public void testConcatenate() {
Junit test = new Junit();
String result= test.Concatenate("one","two");
assertEquals("onetwo",result);
}
}
这就是我的Junit
课程的样子:
包装测试;
public class Junit {
public String Concatenate(String one,String two)
{
return one+two;
}
public int Multiply(int number1,int number2)
{
return number1*number2;
}
}
如果有人告诉我如何解决这个问题,我将非常感激,提前感谢!