import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; boolean trueValue = true; assertTrue(trueValue);
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; int x = 5; assertTrue(x > 0 && x < 10);
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; int y = 10; assertTrue("Y should be greater than zero.", y > 0);In this example, we are verifying that the variable y is greater than 0 and adding a custom message to the assertion. The org.hamcrest.Matchers class is part of the Hamcrest library used for testing in Java.