@Test public void should_fail_if_given_key_is_null_but_actual_does_not_have_null_key() { try { maps.assertContainsKey(description, actual, null); } catch (AssertionError e) { verify(failures).failure(description, shouldContainKey(actual, null)); return; } expectedAssertionErrorNotThrown(); }
@Test public void should_fail_if_actual_does_not_contain_key() { String key = "power"; try { maps.assertContainsKey(description, actual, key); } catch (AssertionError e) { verify(failures).failure(description, shouldContainKey(actual, key)); return; } expectedAssertionErrorNotThrown(); }
@Test public void should_fail_if_actual_is_null() { thrown.expect(AssertionError.class, actualIsNull()); maps.assertContainsKey(description, null, "name"); }
@Test public void should_pass_if_actual_contains_null_key() { actual.put(null, "value"); maps.assertContainsKey(description, actual, null); }
@Test public void should_pass_if_actual_contains_given_key() { maps.assertContainsKey(description, actual, "name"); }