随笔
// assertThat(1,is(1));
// assertThat(2,is(not(1)));
// assertThat(1,allOf(greaterThan(1),lessThan(1)));
// assertThat(1,anyOf(greaterThan(1),lessThan(1)));
// assertThat(1,anything());
//
// assertThat(" ",containsString(" "));
// assertThat(" ",startsWith("123"));
// assertThat(" ",endsWith("123"));
// assertThat(1,equalTo(1));
assertThat("",equalToIgnoringCase("developer works"));
assertThat(" ",equalToIgnoringWhiteSpace("developer works"));
assertThat(0.1,closeTo(3.0,0.3));
assertThat(0.1,greaterThan(3.0));
assertThat(0.1,lessThan(3.0));
assertThat(0.1,greaterThanOrEqualTo(0.1));
assertThat(0.1,lessThanOrEqualTo(0.1));
Map<String,String> map = new HashMap<>();
Iterator iterator = map.entrySet().iterator();
assertThat(map,hasEntry("zhang","zhang"));
// assertThat(iterator,hasEntry("hello")); // 暂时报错
网友评论