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 매처 메서드를 정적으로 가져올지 여부를 지정할 수 있습니다.