ShopServiceTest仍然报错
来源:4-5 店铺注册之Service层的实现
慕桂英1047953
2020-04-03
“D:Program FilesJavajdk-9.0.1injava.exe” -ea -Didea.test.cyclic.buffer.size=1048576 “-javaagent:E:Program FilesJetBrainsIDEAlibidea_rt.jar=11597:E:Program FilesJetBrainsIDEAin” -Dfile.encoding=UTF-8 -classpath “E:Program FilesJetBrainsIDEAlibidea_rt.jar;E:Program FilesJetBrainsIDEApluginsjunitlibjunit5-rt.jar;E:Program FilesJetBrainsIDEApluginsjunitlibjunit-rt.jar;E:ApplicationSpaceo2o arget est-classes;E:ApplicationSpaceo2o argetclasses;E:LocalRepositryjunitjunit.12junit-4.12.jar;E:LocalRepositryorghamcresthamcrest-core.3hamcrest-core-1.3.jar;E:LocalRepositrychqoslogbacklogback-classic.2.3logback-classic-1.2.3.jar;E:LocalRepositrychqoslogbacklogback-core.2.3logback-core-1.2.3.jar;E:LocalRepositryorgslf4jslf4j-api.7.25slf4j-api-1.7.25.jar;E:LocalRepositryorgspringframeworkspring-core.1.8.RELEASEspring-core-5.1.8.RELEASE.jar;E:LocalRepositryorgspringframeworkspring-jcl.1.8.RELEASEspring-jcl-5.1.8.RELEASE.jar;E:LocalRepositryorgspringframeworkspring-beans.1.8.RELEASEspring-beans-5.1.8.RELEASE.jar;E:LocalRepositryorgspringframeworkspring-context.1.8.RELEASEspring-context-5.1.8.RELEASE.jar;E:LocalRepositryorgspringframeworkspring-aop.1.8.RELEASEspring-aop-5.1.8.RELEASE.jar;E:LocalRepositryorgspringframeworkspring-expression.1.8.RELEASEspring-expression-5.1.8.RELEASE.jar;E:LocalRepositryorgspringframeworkspring-jdbc.1.8.RELEASEspring-jdbc-5.1.8.RELEASE.jar;E:LocalRepositryorgspringframeworkspring-tx.1.8.RELEASEspring-tx-5.1.8.RELEASE.jar;E:LocalRepositryorgspringframeworkspring-web.1.8.RELEASEspring-web-5.1.8.RELEASE.jar;E:LocalRepositryorgspringframeworkspring-webmvc.1.8.RELEASEspring-webmvc-5.1.8.RELEASE.jar;E:LocalRepositryorgspringframeworkspring-test.1.8.RELEASEspring-test-5.1.8.RELEASE.jar;E:LocalRepositryjavaxservletjavax.servlet-api.0.1javax.servlet-api-4.0.1.jar;E:LocalRepositrycomasterxmljacksoncorejackson-databind.9.9jackson-databind-2.9.9.jar;E:LocalRepositrycomasterxmljacksoncorejackson-annotations.9.0jackson-annotations-2.9.0.jar;E:LocalRepositrycomasterxmljacksoncorejackson-core.9.9jackson-core-2.9.9.jar;E:LocalRepositrycommons-collectionscommons-collections.2.2commons-collections-3.2.2.jar;E:LocalRepositryorgmybatismybatis.5.1mybatis-3.5.1.jar;E:LocalRepositryorgmybatismybatis-spring.0.1mybatis-spring-2.0.1.jar;E:LocalRepositrymysqlmysql-connector-java.1.46mysql-connector-java-5.1.46.jar;E:LocalRepositrycommchangec3p0.9.5.4c3p0-0.9.5.4.jar;E:LocalRepositrycommchangemchange-commons-java.2.15mchange-commons-java-0.2.15.jar;E:LocalRepositry
etcoobird humbnailator.4.8 humbnailator-0.4.8.jar;E:LocalRepositrycomgithubpengglekaptcha.3.2kaptcha-2.3.2.jar;E:LocalRepositrycomjhlabsilters.0.235-1ilters-2.0.235-1.jar;E:LocalRepositrycommons-fileuploadcommons-fileupload.3.2commons-fileupload-1.3.2.jar;E:LocalRepositrycommons-iocommons-io.2commons-io-2.2.jar;E:LocalRepositry
edisclientsjedis.9.0jedis-2.9.0.jar;E:LocalRepositryorgapachecommonscommons-pool2.4.2commons-pool2-2.4.2.jar” com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 com.imooc.o2o.service.ShopServiceTest,testAddShop
2020-04-03 21:07:04.752 [main] INFO o.s.t.c.support.DefaultTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
2020-04-03 21:07:04.758 [main] INFO o.s.t.c.support.DefaultTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@cecf639, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@1caa0244, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@7ce026d3, org.springframework.test.context.support.DirtiesContextTestExecutionListener@7ce69770, org.springframework.test.context.transaction.TransactionalTestExecutionListener@1750fbeb, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@5b247367]
2020-04-03 21:07:05.301 [MLog-Init-Reporter] INFO com.mchange.v2.log.MLog - MLog clients using slf4j logging.
2020-04-03 21:07:05.691 [main] INFO com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.5.4 [built 23-March-2019 23:00:48 -0700; debug? true; trace: 10]
2020-04-03 21:07:06.011 [main] INFO c.m.v2.c3p0.impl.AbstractPoolBackedDataSource - Initializing c3p0 pool… com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 2, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 10000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1hge1ewa9hssp3n11r295v|1601e47, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hge1ewa9hssp3n11r295v|1601e47, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/o2o, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {password=******, user=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
2020-04-03 21:07:06.011 [main] WARN com.mchange.v2.resourcepool.BasicResourcePool - Bad pool size config, start 3 < min 10. Using 10 as start.
2020-04-03 21:07:06.285 [main] DEBUG com.imooc.o2o.dao.ShopDao.insertShop - ==> Preparing: INSERT INTO tb_shop(owner_id, area_id, shop_category_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice) VALUES (?,?,?,?, ?,?,?,?,?, ?,?, ?,?)
2020-04-03 21:07:06.332 [main] DEBUG com.imooc.o2o.dao.ShopDao.insertShop - > Parameters: 1(Long), 2(Integer), null, 测试的店铺1(String), test1(String), test1(String), test(String), null, null, 2020-04-03 21:07:05.98(Timestamp), 2020-04-03 21:07:05.98(Timestamp), 0(Integer), 审核中(String)
2020-04-03 21:07:06.332 [main] DEBUG com.imooc.o2o.dao.ShopDao.insertShop - < Updates: 1
2020-04-03 21:07:06.347 [main] DEBUG com.imooc.o2o.util.ImageUtil - current relativeAddr is:webworfkimagesitemshop‚0040321070693682.jpg
2020-04-03 21:07:06.347 [main] DEBUG com.imooc.o2o.util.ImageUtil - current complete addr is:D:projectimagewebworfkimagesitemshop‚0040321070693682.jpg
javax.imageio.IIOException: Can’t read input file!
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1308)
at com.imooc.o2o.util.ImageUtil.generatThumbnail(ImageUtil.java:49)
at com.imooc.o2o.service.impl.ShopServiceImpl.addShopImg(ShopServiceImpl.java:60)
at com.imooc.o2o.service.impl.ShopServiceImpl.addShop(ShopServiceImpl.java:40)
at com.imooc.o2o.service.ShopServiceTest.testAddShop(ShopServiceTest.java:41)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner2.evaluate(ParentRunner.java:268)atorg.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)atorg.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)atorg.junit.runners.ParentRunner.run(ParentRunner.java:363)atorg.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)atorg.junit.runner.JUnitCore.run(JUnitCore.java:137)atcom.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)atcom.intellij.rt.junit.IdeaTestRunner2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner2.evaluate(ParentRunner.java:268)atorg.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)atorg.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)atorg.junit.runners.ParentRunner.run(ParentRunner.java:363)atorg.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)atorg.junit.runner.JUnitCore.run(JUnitCore.java:137)atcom.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)atcom.intellij.rt.junit.IdeaTestRunnerRepeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
2020-04-03 21:07:06.410 [main] DEBUG com.imooc.o2o.dao.ShopDao.updateShop - ==> Preparing: update tb_shop SET shop_name=?, shop_desc=?, shop_addr=?, phone=?, shop_img=?, last_edit_time=?, enable_status=?, advice=?, area_id=? where shop_id=?
2020-04-03 21:07:06.410 [main] DEBUG com.imooc.o2o.dao.ShopDao.updateShop - > Parameters: 测试的店铺1(String), test1(String), test1(String), test(String), webworfkimagesitemshop‚0040321070693682.jpg(String), 2020-04-03 21:07:05.98(Timestamp), 0(Integer), 审核中(String), 2(Integer), 4(Long)
2020-04-03 21:07:06.410 [main] DEBUG com.imooc.o2o.dao.ShopDao.updateShop - < Updates: 1
Process finished with exit code 0
而且换用绝对路径之后仍然报错
1回答
-
啊顾顾
2020-04-03
同学好,根据你的日志 打印出来的relativeAddr 和completeAddr都是有问题的诶。。 再仔细检查看看?
112020-04-04
相似问题