java.lang.Exception: Method a() should be public

简介: java.lang.Exception: Method a() should be public

场景:在使用spring boot测试接口时报错

原因:调用了错误的方法

报错:

java.lang.Exception: Method a() should be public

   at org.junit.runners.model.FrameworkMethod.validatePublicVoid(FrameworkMethod.java:96)

   at org.junit.runners.model.FrameworkMethod.validatePublicVoidNoArg(FrameworkMethod.java:74)

   at org.junit.runners.ParentRunner.validatePublicVoidNoArgMethods(ParentRunner.java:155)

   at org.junit.runners.BlockJUnit4ClassRunner.validateTestMethods(BlockJUnit4ClassRunner.java:208)

   at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:188)

   at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:128)

   at org.junit.runners.ParentRunner.validate(ParentRunner.java:416)

   at org.junit.runners.ParentRunner.<init>(ParentRunner.java:84)

   at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:65)

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

   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.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:36)

   at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:50)

   at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)

   at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)

   at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)

   at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)

   at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

相关文章
|
28天前
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘quanZiController‘ method
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘quanZiController‘ method
14 0
|
7月前
解决java.lang.Exception:No runnable methods问题~
解决java.lang.Exception:No runnable methods问题~
|
7月前
|
前端开发 Cloud Native Java
已解决‘Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPoint
已解决‘Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPoint
76 0
|
7月前
|
Java Spring
【Java异常】Caused by: java.lang.IllegalStateException: Method has too many Body parameters
【Java异常】Caused by: java.lang.IllegalStateException: Method has too many Body parameters
15 0
|
9月前
Failed to start bean ‘documentationPluginsBootstrapper nested exception is java.lang.NullPointerE
Failed to start bean ‘documentationPluginsBootstrapper nested exception is java.lang.NullPointerE
34 0
|
10月前
|
Java 测试技术
已解决 java.lang.Exception: No runnable methods 异常
已解决 java.lang.Exception: No runnable methods 异常
111 0
|
12月前
|
Java Spring
java异常之-Caused by: java.lang.IllegalStateException: Method has too many Body parameters
java异常之-Caused by: java.lang.IllegalStateException: Method has too many Body parameters
257 0
|
Java 数据库 Spring
Failed to instantiate [java.lang.Long]: No default constructor found;nested exception is java.lang()
Failed to instantiate [java.lang.Long]: No default constructor found;nested exception is java.lang()
Failed to instantiate [java.lang.Long]: No default constructor found;nested exception is java.lang()
报错解决:java.lang.Exception: Method testGetNickNameById should have no parameters
报错解决:java.lang.Exception: Method testGetNickNameById should have no parameters
264 0
Caused by: java.lang.NoSuchMethodError:No virtual method isSuccess()Z in class Lretrofit2/Response;
Caused by: java.lang.NoSuchMethodError:No virtual method isSuccess()Z in class Lretrofit2/Response;
566 0

热门文章

最新文章