Android/Android
[Test] Hamcrest를 위한 Junit의 assertThat이 Deprecated된 건에 대해
RIEN😚
2024. 11. 19. 14:34
728x90
반응형
Replace JUnit assertThat with Hamcrest | jSparrow Documentation
Replace JUnit assertThat with Hamcrest Description The JUnit Assert.assertThat (opens new window) method is deprecated. Its sole purpose is to forward the call to the MatcherAssert.assertThat (opens new window) method defined in Hamcrest 1.3. Therefore, it
jsparrow.github.io
Hamcrest를 다시 사용해보려고 하던 중
assertThat이 Deprecated 되었다는 것을 알게 되었습니다. 🥲
// 이전 코드
import org.junit.Assert.*
// 사용 코드
assertThat(result, `is`(true))
그래서 공식 문서 등을 찾아보니 Deprecated된 JUnit의 assertThat을 대신하여
Hamcrest 1.3에서 제공해준다고 하네요~. 👍🏻
// 새로운 코드
import org.hamcrest.MatcherAssert.assertThat
// 사용 코드
assertThat(result, `is`(true))
반응형