Listnames = Arrays.asList("John", "Jane", "Mike"); MatcherAssert.assertThat(names, hasItem("Mike"));
String email = "[email protected]"; MatcherAssert.assertThat(email, matchesPattern("[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}"));In this example, the `matchesPattern` matcher is used to assert that the string `email` matches the regular expression for a valid email address. These examples are using the Hamcrest library, which is typically included in Java projects through a dependency management system like Maven or Gradle. The package name for Hamcrest is usually `org.hamcrest`, with additional subpackages for specific matchers and other utilities.