手动导包&单元测试junit4

1. 下载jar

  hamcrest-core-1.3.jar
  junit-4.12.jar

2. 下载地址 : 

  https://mvnrepository.com/artifact/junit/junit/4.12

  https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core/1.3

3. 手动导包

手动导包&单元测试junit4

添加成功

手动导包&单元测试junit4

4. 注意事项

  这种方式只能为指定model添加jar,不会对整个project有效

5.  代码示例

package com.dxm.java;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * @author gaocun
 * @create 2021-09-13 8:27 AM
 */
public class demo01 {
    @Before
    public void testBefore()
    {
        System.out.println("在@Test修饰的方法之前执行");
    }
    @Test
    public void test01()
    {
        System.out.println("1000");
    }
    @Test
    public void test02()
    {
        System.out.println("2000");
    }
    @After
    public void testAfter()
    {
        System.out.println("在@Test修改的方法之后执行");
    }
}

 

上一篇:Spring整合MyBatis


下一篇:spring框架学习之mybatis