首页 > 学院 > 开发设计 > 正文

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

2019-11-10 20:26:41
字体:
来源:转载
供稿:网友

今天使用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 typepublic 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 { @Testpublic 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"));} }


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表