Hamcrest 선언 스타일의 Assert.assertThat() 호출로 마이그레이션할 수 있는 Assert.assertEquals(), Assert.assertTrue() 등의 메서드 호출을 보고합니다.

예:


  public class SubstantialTest {
    @Test
    public void testContents(Collection<String> c, String s) {
      Assert.assertTrue(c.contains(s));
      Assert.assertEquals(c, s);
      Assert.assertNotNull(c);
      Assert.assertNull(c);
      Assert.assertFalse(c.contains(s));
    }
  }

마이그레이션 수행을 위한 빠른 수정이 제공됩니다.


  public class SubstantialTest {
    @Test
    public void testContents(Collection<String> c, String s) {
      assertThat(c, hasItem(o));
      assertThat(o, is(c));
      assertThat(c, notNullValue());
      assertThat(c, nullValue());
      assertThat(c, not(hasItem(o)));
    }
  }

이 검사를 사용하려면 클래스 경로에 Hamcrest 라이브러리가 있어야 합니다.

매처 메서드를 정적으로 가져오기 옵션을 사용하여 Hamcrest 매처 메서드를 정적으로 가져오는 데 빠른 수정을 사용할지 설정할 수 있습니다.