解决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"));
}
}
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"));
}
}
相关文章推荐
- junit的Test突然不能用了-Test is not an annotation type
- Junit4-Test is not an annotation type
- junit 单元测试 @Test报错:@Test is not an annotation type
- error Type referred to is not an annotation type 一个解决办法
- 使用AOP处理注解时出现error Type referred to is not an annotation type:xxx
- error Type referred to is not an annotation type: validate 0 formal unbound in pointcut
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction
- "Only TrueType fonts are supported. This is not a TrueType font."问题解决
- “this._postbackSettings.async is null or not an object”问题的解决
- Bean property 'RegDao' is not writable or has an invalid setter method. Does the parameter type of t
- _IsPtrType -- STL type checking on compile-time -- Substitution Failure Is Not An Error (SFINAE)
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction
- OSCache的源码编译Cache.java 文件报add(Class, T) in the type EventListenerList is not applicable for the arguments 错误的解决
- JUNIT遇到问题An instrumention test runner is not specified
- error C3872: '0x3000': this character is not allowed in an identifier 解决方法
- 解决此类问题:warning: unable to bind to property '' on class 'Object' (class is not an IEventDispatcher) .
- Spring + toplink-essentials(JPA) is not a known entity type 问题解决
- 解决TypeName is not valid. Type parameters are only available if source level is 5.0.
- "Only TrueType fonts are supported. This is not a TrueType font."问题解决