今天使用junit做沒底時(shí),報(bào)了一個(gè)提示!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"));} }
仔細(xì)檢查了一下,類名也叫Test,結(jié)果是沖突了!暈了!改正后
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"));} }
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注