By
using ‘isOneOf’ method, you can create a matcher that matches when the examined
object is equal to one of the specified elements.
Ex
assertThat("India",
isOneOf("Africa", "India", "Sri Lanka"));
TestApp.java
package com.sample.tests; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.isOneOf; import org.junit.Test; public class TestApp { @Test public void testmethod() { assertThat("India", isOneOf("Africa", "India", "Sri Lanka")); } }
No comments:
Post a Comment