在maven项目中使用Junit的assertThat()方法时,is()方法的使用
来源:互联网 发布:淘宝内部优惠券采集 编辑:程序博客网 时间:2024/06/16 08:30
1.要使用is()方法首先需要导入hamcrest-library-1.3.jar和hamcrest-core-1.3.jar两个jar包
依赖配置:
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
import static org.junit.Assert.*;
import org.junit.Test;
import static org.hamcrest.Matchers.*;
public class TestGetName {
@Test
public void testGetName() {
assertThat(new User().getName(),is("mafx"));
}
}
阅读全文
0 0
- 在maven项目中使用Junit的assertThat()方法时,is()方法的使用
- Junit的AssertThat方法表达式
- 在MyEclipse中使用Junit 的方法
- 在MyEclipse中使用Junit 的方法
- 在MyEclipse中使用Junit 的方法
- 在maven项目中使用Junit进行单元测试(一)
- JUnit中使用Hamcrest测试框架的assertThat断言【4.4新特性】
- JUnit中使用Hamcrest测试框架的assertThat断言【4.4新特性】
- junit的assertThat
- 使用Junit的suite()方法
- IDEA 在Maven项目管理时使用Junit做单元测试的配置
- 解决 使用了maven的项目中,进行Junit测试时的 java.lang.NoClassDefFoundError
- maven项目在tomcat7中运行时的方法
- maven项目在tomcat7中运行时的方法
- 在spring下使用junit做单元测试的基本方法
- 项目中添加Junit测试的方法
- Maven项目使用Junit
- 在 Intellij IDEA中设置Maven 路径及配置文件的方法(使用阿里云Maven源)
- 【福分系统】bootstrap表格控件
- jquery实现品牌列表的显示
- 自定义bs soup的抓取函数,查找不含某个class属性tag 以及一个小问题'NoneType' object has no attribute '__getitem__'
- URAL 1996 Cipher Message 3 FFT KMP
- leetcode200. Number of Islands
- 在maven项目中使用Junit的assertThat()方法时,is()方法的使用
- Linux之Shell基础
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 J Minimum Distance in a Star Graph 广度优先搜索
- xtu 8
- bzoj 4590: [Shoi2015]自动刷题机
- kibana安装使用
- jquery实现全选 全不选效果
- hdu6206 Apple 2017icpc青岛赛区 java高精度类
- C++ 容器的正向和反向迭代