今天使用junit做没底时,报了一个提示!test is not an annotation type,在方法上加上@org.junit.Test就没有问题,如下
import org.junit.Test;
import redis.clients.jedis.Jedis;
public class Test {
@Test,此处提示Test is not an annotation type
public void test_string() {
Jedis jedis = new Jedis("localhost");
System.out.println("Connection to server successfully");
jedis.set("mykey", "zosef");
System.out.println("Server is running:"+jedis.get("mykey"));
}
}
仔细检查了一下,类名也叫Test,结果是冲突了!晕了!改正后
import org.junit.Test;
import redis.clients.jedis.Jedis;
public class JedisTest {
@Test
public void test_string() {
Jedis jedis = new Jedis("localhost");
System.out.println("Connection to server successfully");
jedis.set("mykey", "zosef");
System.out.println("Server is running:"+jedis.get("mykey"));
}
}