Check out example codes for "error: The method assertThat(T, Matcher<? super T>) in the type MatcherAssert is not applicable for the arguments (List<String>, Matcher<Iterable<Integer>>)". It will help you in understanding the concepts better.

Code Example 1

assertTrue(result instanceof String);
// error message:
    at org.junit.Assert.assertTrue(
    at org.junit.Assert.assertTrue(
// ...

assertEquals(String.class, result.getClass());
// error message:
    at com.vogella.hamcrest.HamcrestTest.test(
// ....

assertThat(result, instanceOf(String.class));
// error message:
Expected: an instance of java.lang.String
     but: null
    at org.hamcrest.MatcherAssert.assertThat(
    at org.hamcrest.MatcherAssert.assertThat(
// ...

Code Example 2

assertThat("test", anyOf(is("testing"), containsString("est")));

Code Example 3

// JUnit 4 for equals check
assertEquals(expected, actual);
// Hamcrest for equals check
assertThat(actual, is(equalTo(expected)));

// JUnit 4 for not equals check
assertNotEquals(expected, actual)
// Hamcrest for not equals check
assertThat(actual, is(not(equalTo(expected))));

Code Example 4

import static org.hamcrest.MatcherAssert.assertThat;
import static;
import static org.hamcrest.Matchers.equalTo;

boolean a;
boolean b;

// all statements test the same
assertThat(a, equalTo(b));
assertThat(a, is(equalTo(b)));
assertThat(a, is(b));

Learn ReactJs, React Native from