junit的使用

1、加入 junit jar包

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>

2、标注@Test注解、调用测试框架方法、调用 httpclient 方法

Assert.assertNotNull(user);
Assert.assertNull(user.getId());
Assert.assertTrue(userList.size() > 0);
Assert.assertEquals("admin", user.getUserName()); 

junit、spring-test 的使用

1、加入 junit 及 spring-test jar包

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>4.3.14.RELEASE</version>
</dependency>
View Code

相关文章:

  • 2021-12-31
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2021-10-05
  • 2022-01-30
猜你喜欢
  • 2021-09-06
  • 2022-02-21
  • 2021-08-03
  • 2022-12-23
  • 2021-10-11
  • 2021-11-10
  • 2022-12-23
相关资源
相似解决方案