为了账号安全,请及时绑定邮箱和手机立即绑定

mvn test 有测试错误,哪位大神帮我看下

D:\搜狗高速下载\Ecilpse8.5 64\code\maven01>mvn test

[INFO] Scanning for projects...

[WARNING]

[WARNING] Some problems were encountered while building the effective model for

com.imooc.maven01:maven01-model:jar:0.0.1SNAPSHOT

[WARNING] 'version' uses an unsupported snapshot version format, should be '*-SN

APSHOT' instead. @ line 11, column 11

[WARNING]

[WARNING] It is highly recommended to fix these problems because they threaten t

he stability of your build.

[WARNING]

[WARNING] For this reason, future Maven versions might no longer support buildin

g such malformed projects.

[WARNING]

[INFO]

[INFO] ------------------< com.imooc.maven01:maven01-model >-------------------

[INFO] Building maven01-model 0.0.1SNAPSHOT

[INFO] --------------------------------[ jar ]---------------------------------

[INFO]

[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven01-mo

del ---

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e

. build is platform dependent!

[INFO] skip non existing resourceDirectory D:\搜狗高速下载\Ecilpse8.5 64\code\ma

ven01\src\main\resources

[INFO]

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven01-model -

--

[INFO] Nothing to compile - all classes are up to date

[INFO]

[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ma

ven01-model ---

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e

. build is platform dependent!

[INFO] skip non existing resourceDirectory D:\搜狗高速下载\Ecilpse8.5 64\code\ma

ven01\src\test\resources

[INFO]

[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ maven01

-model ---

[INFO] Nothing to compile - all classes are up to date

[INFO]

[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven01-model ---

[INFO] Surefire report directory: D:\搜狗高速下载\Ecilpse8.5 64\code\maven01\tar

get\surefire-reports


-------------------------------------------------------

 T E S T S

-------------------------------------------------------

Running com.imooc.maven01.model.HelloWorldTest

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.07 sec <<< FAI

LURE!

testHello(com.imooc.maven01.model.HelloWorldTest)  Time elapsed: 0.01 sec  <<< F

AILURE!

org.junit.ComparisonFailure: expected:<Hello[ ]World> but was:<Hello[]World>

        at org.junit.Assert.assertEquals(Assert.java:115)

        at org.junit.Assert.assertEquals(Assert.java:144)

        at com.imooc.maven01.model.HelloWorldTest.testHello(HelloWorldTest.java:

9)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Framework

Method.java:47)

        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCal

lable.java:12)

        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMe

thod.java:44)

        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMet

hod.java:17)

        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRun

ner.java:70)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRun

ner.java:50)

        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)

        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provide

r.java:252)

        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4

Provider.java:141)

        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider

.java:112)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(

ReflectionUtils.java:189)

        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke

(ProviderFactory.java:165)

        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(Provi

derFactory.java:85)

        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(Fork

edBooter.java:115)

        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:

75)



Results :


Failed tests:   testHello(com.imooc.maven01.model.HelloWorldTest): expected:<Hel

lo[ ]World> but was:<Hello[]World>


Tests run: 1, Failures: 1, Errors: 0, Skipped: 0


[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 1.978 s

[INFO] Finished at: 2018-07-07T16:05:34+08:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.

12.4:test (default-test) on project maven01-model: There are test failures.

[ERROR]

[ERROR] Please refer to D:\搜狗高速下载\Ecilpse8.5 64\code\maven01\target\surefi

re-reports for the individual test results.

[ERROR] -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit

ch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please rea

d the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc

eption


D:\搜狗高速下载\Ecilpse8.5 64\code\maven01>

D:\搜狗高速下载\Ecilpse8.5 64\code\maven01>

D:\搜狗高速下载\Ecilpse8.5 64\code\maven01>[ERROR] For more information about th

e errors and possible solutions, please rea

'[ERROR]' 不是内部或外部命令,也不是可运行的程序

或批处理文件。


D:\搜狗高速下载\Ecilpse8.5 64\code\maven01>d the following articles:[ERROR] For

more information about the errors and possible solutions, please rea

'd' 不是内部或外部命令,也不是可运行的程序

或批处理文件。


D:\搜狗高速下载\Ecilpse8.5 64\code\maven01>d the following articles:


D:\搜狗高速下载\Ecilpse8.5 64\code\maven01>[ERROR] Please refer to D:\搜狗高速下

载\Ecilpse8.5 64\code\maven01\target\surefi

'[ERROR]' 不是内部或外部命令,也不是可运行的程序

或批处理文件。


D:\搜狗高速下载\Ecilpse8.5 64\code\maven01>re-reports for the individual test re

sults.[ERROR] Please refer to D:\搜狗高速下载\Ecilpse8.5 64\code\maven01\target\

surefi

're-reports' 不是内部或外部命令,也不是可运行的程序

或批处理文件。


D:\搜狗高速下载\Ecilpse8.5 64\code\maven01>mvn test

[INFO] Scanning for projects...

[WARNING]

[WARNING] Some problems were encountered while building the effective model for

com.imooc.maven01:maven01-model:jar:0.0.1SNAPSHOT

[WARNING] 'version' uses an unsupported snapshot version format, should be '*-SN

APSHOT' instead. @ line 11, column 11

[WARNING]

[WARNING] It is highly recommended to fix these problems because they threaten t

he stability of your build.

[WARNING]

[WARNING] For this reason, future Maven versions might no longer support buildin

g such malformed projects.

[WARNING]

[INFO]

[INFO] ------------------< com.imooc.maven01:maven01-model >-------------------

[INFO] Building maven01-model 0.0.1SNAPSHOT

[INFO] --------------------------------[ jar ]---------------------------------

[INFO]

[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven01-mo

del ---

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e

. build is platform dependent!

[INFO] skip non existing resourceDirectory D:\搜狗高速下载\Ecilpse8.5 64\code\ma

ven01\src\main\resources

[INFO]

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven01-model -

--

[INFO] Nothing to compile - all classes are up to date

[INFO]

[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ma

ven01-model ---

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e

. build is platform dependent!

[INFO] skip non existing resourceDirectory D:\搜狗高速下载\Ecilpse8.5 64\code\ma

ven01\src\test\resources

[INFO]

[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ maven01

-model ---

[INFO] Nothing to compile - all classes are up to date

[INFO]

[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven01-model ---

[INFO] Surefire report directory: D:\搜狗高速下载\Ecilpse8.5 64\code\maven01\tar

get\surefire-reports


-------------------------------------------------------

 T E S T S

-------------------------------------------------------

Running com.imooc.maven01.model.HelloWorldTest

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.065 sec <<< FA

ILURE!

testHello(com.imooc.maven01.model.HelloWorldTest)  Time elapsed: 0.009 sec  <<<

FAILURE!

org.junit.ComparisonFailure: expected:<Hello[ ]World> but was:<Hello[]World>

        at org.junit.Assert.assertEquals(Assert.java:115)

        at org.junit.Assert.assertEquals(Assert.java:144)

        at com.imooc.maven01.model.HelloWorldTest.testHello(HelloWorldTest.java:

9)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Framework

Method.java:47)

        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCal

lable.java:12)

        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMe

thod.java:44)

        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMet

hod.java:17)

        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRun

ner.java:70)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRun

ner.java:50)

        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)

        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provide

r.java:252)

        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4

Provider.java:141)

        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider

.java:112)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(

ReflectionUtils.java:189)

        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke

(ProviderFactory.java:165)

        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(Provi

derFactory.java:85)

        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(Fork

edBooter.java:115)

        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:

75)



Results :


Failed tests:   testHello(com.imooc.maven01.model.HelloWorldTest): expected:<Hel

lo[ ]World> but was:<Hello[]World>


Tests run: 1, Failures: 1, Errors: 0, Skipped: 0


[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 1.926 s

[INFO] Finished at: 2018-07-07T16:42:04+08:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.

12.4:test (default-test) on project maven01-model: There are test failures.

[ERROR]

[ERROR] Please refer to D:\搜狗高速下载\Ecilpse8.5 64\code\maven01\target\surefi

re-reports for the individual test results.

[ERROR] -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit

ch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please rea

d the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc

eption


D:\搜狗高速下载\Ecilpse8.5 64\code\maven01>


正在回答

3 回答

expected:<Hello[ ]World> but was:<Hello[]World>

断言不相等 一个是Hello  World  一个是HelloWorld

0 回复 有任何疑惑可以回复我~
#1

RSF 提问者

非常感谢
2018-07-09 回复 有任何疑惑可以回复我~

非常感谢

0 回复 有任何疑惑可以回复我~

sayHello的return语句的内容要和testHello里的第一个字符串内容要相等,检查是不是第一个漏了"!".

0 回复 有任何疑惑可以回复我~
#1

RSF 提问者

非常感谢
2018-07-09 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
项目管理利器——maven
  • 参与学习       173090    人
  • 解答问题       742    个

使用maven来构建和管理Java项目,从环境配置,到maven核心知识

进入课程

mvn test 有测试错误,哪位大神帮我看下

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信