インポート部分はこんな感じ
import org.hamcrest.Matchers.*
import org.junit.Test
import org.junit.Assert.*
変数val
が hogeかfugaであることをテストするには、以下のように記述すればよい。
assertThat(val, anyOf(equalTo("hoge"), equalTo("fuga")))
assetThatは色々柔軟な書き方が出来そう。
More than 5 years have passed since last update.
インポート部分はこんな感じ
import org.hamcrest.Matchers.*
import org.junit.Test
import org.junit.Assert.*
変数val
が hogeかfugaであることをテストするには、以下のように記述すればよい。
assertThat(val, anyOf(equalTo("hoge"), equalTo("fuga")))
assetThatは色々柔軟な書き方が出来そう。
Register as a new user and use Qiita more conveniently