您的位置:首页 > 其它

解决test is not an annotation type一种方案

2017-02-08 11:35 405 查看
今天使用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"));

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐