在进行SeckillDao单元测试时,出现了java.lang.TypeNotPresentException: Type SpringJunit4ClassRunner not present错误。。。咋办啊各位大神~

来源:4-8 DAO层单元测试编码和问题排查(上)

weixin_慕设计6143428

2019-08-05 17:25

java.lang.TypeNotPresentException: Type SpringJunit4ClassRunner not present

at sun.reflect.annotation.TypeNotPresentExceptionProxy.generateException(TypeNotPresentExceptionProxy.java:46)

at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:84)

at com.sun.proxy.$Proxy2.value(Unknown Source)

at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)

at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)

at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)

at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)

at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:525)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)

Caused by: java.lang.ClassNotFoundException: SpringJunit4ClassRunner

at java.net.URLClassLoader.findClass(URLClassLoader.java:382)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:348)

at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)

at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)

at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)

at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:439)

at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:420)

at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:349)

at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)

at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)

at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)

at java.lang.Class.createAnnotationData(Class.java:3521)

at java.lang.Class.annotationData(Class.java:3510)

at java.lang.Class.getAnnotation(Class.java:3415)

at org.junit.internal.builders.IgnoredBuilder.runnerForClass(IgnoredBuilder.java:10)

... 11 more


https://img3.mukewang.com/5d47f6010001446b08560266.jpg

写回答 关注

1回答

  • 慕粉2201526880
    2019-08-25 03:47:08

    spring-test 是测试环境下依赖的,不懂就百度

Java高并发秒杀API之业务分析与DAO层

Java实现高并发秒杀API的第一门课,还等什么,赶快来加入吧

87424 学习 · 496 问题

查看课程

相似问题