@Test public void testKvMatcherKeyFailure() throws Exception { AssertionError exc = assertionShouldFail( () -> assertThat(KV.of(1, 2), SerializableMatchers.kv(not(anything()), anything()))); assertThat(exc.getMessage(), Matchers.containsString("key did not match")); }
@Test public void testKvMatcherValueFailure() throws Exception { AssertionError exc = assertionShouldFail( () -> assertThat(KV.of(1, 2), SerializableMatchers.kv(anything(), not(anything())))); assertThat(exc.getMessage(), Matchers.containsString("value did not match")); }
@Test public void testKvMatcherGBKLikeFailure() throws Exception { AssertionError exc = assertionShouldFail( () -> assertThat( KV.of("key", ImmutableList.of(1, 2, 3)), SerializableMatchers.<String, Iterable<Integer>>kv( anything(), containsInAnyOrder(1, 2, 3, 4)))); assertThat(exc.getMessage(), Matchers.containsString("value did not match")); }
@Test public void testKvMatcherBasicSuccess() throws Exception { assertThat(KV.of(1, 2), SerializableMatchers.kv(anything(), anything())); }
@Test public void testKvMatcherGBKLikeSuccess() throws Exception { assertThat( KV.of("key", ImmutableList.of(1, 2, 3)), SerializableMatchers.<Object, Iterable<Integer>>kv( anything(), containsInAnyOrder(3, 2, 1))); }