test类报错

来源:1-4 JdbcTemplate数据写入方法

小白0719

2023-01-19 21:37:12

老师,我的测试类能查询到结果,请帮忙看看是什么原因?

D:\tools\jdk8\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\tools\idea\IntelliJ IDEA 2020.3.4\lib\idea_rt.jar=61741:D:\tools\idea\IntelliJ IDEA 2020.3.4\bin" -Dfile.encoding=UTF-8 -classpath "D:\tools\idea\IntelliJ IDEA 2020.3.4\lib\idea_rt.jar;D:\tools\idea\IntelliJ IDEA 2020.3.4\plugins\junit\lib\junit5-rt.jar;D:\tools\idea\IntelliJ IDEA 2020.3.4\plugins\junit\lib\junit-rt.jar;D:\tools\jdk8\jre\lib\charsets.jar;D:\tools\jdk8\jre\lib\deploy.jar;D:\tools\jdk8\jre\lib\ext\access-bridge-64.jar;D:\tools\jdk8\jre\lib\ext\cldrdata.jar;D:\tools\jdk8\jre\lib\ext\dnsns.jar;D:\tools\jdk8\jre\lib\ext\jaccess.jar;D:\tools\jdk8\jre\lib\ext\jfxrt.jar;D:\tools\jdk8\jre\lib\ext\localedata.jar;D:\tools\jdk8\jre\lib\ext\nashorn.jar;D:\tools\jdk8\jre\lib\ext\sunec.jar;D:\tools\jdk8\jre\lib\ext\sunjce_provider.jar;D:\tools\jdk8\jre\lib\ext\sunmscapi.jar;D:\tools\jdk8\jre\lib\ext\sunpkcs11.jar;D:\tools\jdk8\jre\lib\ext\zipfs.jar;D:\tools\jdk8\jre\lib\javaws.jar;D:\tools\jdk8\jre\lib\jce.jar;D:\tools\jdk8\jre\lib\jfr.jar;D:\tools\jdk8\jre\lib\jfxswt.jar;D:\tools\jdk8\jre\lib\jsse.jar;D:\tools\jdk8\jre\lib\management-agent.jar;D:\tools\jdk8\jre\lib\plugin.jar;D:\tools\jdk8\jre\lib\resources.jar;D:\tools\jdk8\jre\lib\rt.jar;D:\javaproject\4.12.spring-jdbc\eg\eg1\target\test-classes;D:\javaproject\4.12.spring-jdbc\eg\eg1\target\classes;D:\tools\maven\.m2\repository\org\springframework\spring-context\5.2.6.RELEASE\spring-context-5.2.6.RELEASE.jar;D:\tools\maven\.m2\repository\org\springframework\spring-aop\5.2.6.RELEASE\spring-aop-5.2.6.RELEASE.jar;D:\tools\maven\.m2\repository\org\springframework\spring-beans\5.2.6.RELEASE\spring-beans-5.2.6.RELEASE.jar;D:\tools\maven\.m2\repository\org\springframework\spring-core\5.2.6.RELEASE\spring-core-5.2.6.RELEASE.jar;D:\tools\maven\.m2\repository\org\springframework\spring-jcl\5.2.6.RELEASE\spring-jcl-5.2.6.RELEASE.jar;D:\tools\maven\.m2\repository\org\springframework\spring-expression\5.2.6.RELEASE\spring-expression-5.2.6.RELEASE.jar;D:\tools\maven\.m2\repository\org\springframework\spring-jdbc\5.2.6.RELEASE\spring-jdbc-5.2.6.RELEASE.jar;D:\tools\maven\.m2\repository\org\springframework\spring-tx\5.2.6.RELEASE\spring-tx-5.2.6.RELEASE.jar;D:\tools\maven\.m2\repository\mysql\mysql-connector-java\8.0.21\mysql-connector-java-8.0.21.jar;D:\tools\maven\.m2\repository\com\google\protobuf\protobuf-java\3.11.4\protobuf-java-3.11.4.jar;D:\tools\maven\.m2\repository\org\springframework\spring-test\5.2.6.RELEASE\spring-test-5.2.6.RELEASE.jar;D:\tools\maven\.m2\repository\junit\junit\4.12\junit-4.12.jar;D:\tools\maven\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\tools\maven\.m2\repository\org\junit\jupiter\junit-jupiter\5.9.2\junit-jupiter-5.9.2.jar;D:\tools\maven\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.9.2\junit-jupiter-api-5.9.2.jar;D:\tools\maven\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;D:\tools\maven\.m2\repository\org\junit\platform\junit-platform-commons\1.9.2\junit-platform-commons-1.9.2.jar;D:\tools\maven\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;D:\tools\maven\.m2\repository\org\junit\jupiter\junit-jupiter-params\5.9.2\junit-jupiter-params-5.9.2.jar;D:\tools\maven\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.9.2\junit-jupiter-engine-5.9.2.jar;D:\tools\maven\.m2\repository\org\junit\platform\junit-platform-engine\1.9.2\junit-platform-engine-1.9.2.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 com.imooc.dao.EmployeeDaoTest,select3
一月 19, 2023 9:30:54 下午 org.springframework.test.context.support.AbstractTestContextBootstrapper getDefaultTestExecutionListenerClassNames
信息: 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, org.springframework.test.context.event.EventPublishingTestExecutionListener]
一月 19, 2023 9:30:54 下午 org.springframework.test.context.support.AbstractTestContextBootstrapper getTestExecutionListeners
信息: Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@5f341870, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@553f17c, org.springframework.test.context.support.DirtiesContextTestExecutionListener@4f7d0008, org.springframework.test.context.transaction.TransactionalTestExecutionListener@271053e1, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@589838eb, org.springframework.test.context.event.EventPublishingTestExecutionListener@42dafa95]
[{a=3308, b=张三}, {a=3420, b=李四}]

Process finished with exit code 0
package com.imooc.dao;
import com.imooc.entity.Employee;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
public class EmployeeDaoTest {
   @Resource
    EmployeeDao employeeDao;
        @Test
        public void selectByEno() {

            Employee employee = employeeDao.selectByEno(3308);

            System.out.println(employee);
        }

    @Test
    public void selectByMore() {
        List<Employee> maps = employeeDao.selectByMore("研发部");
        System.out.println(maps);
    }
    @Test
    public void select3() {
        List<Map<String, Object>> maps = employeeDao.select3("研发部");
        System.out.println(maps);
    }

}



写回答

1回答

好帮手慕小尤

2023-01-20

同学你好,是一些日志信息,并不是报错信息。同学正常运行就可以了,异常信息一般会在前缀会有error。

祝学习愉快!

0

0 学习 · 9886 问题

查看课程

相似问题