ListmyList = Arrays.asList("foo", "bar", "baz"); assertThat(myList, hasItems("foo", "baz"));
String name = "John"; assertThat(name, equalTo("John"));This will pass the test because the name variable is equal to "John". The org.hamcrest.Matchers class is part of the Hamcrest library, which provides a set of matchers for unit testing in Java. To use the Matchers class, you need to include the hamcrest-core library in your project's classpath. The package name for the Hamcrest library is org.hamcrest.