actualAsString(), entry, value, keys))); } else { fail("contains entry", entry);
public void lacksValue(V key) { if (getSubject().containsValue(key)) { fail("lacks value", key); } }
/** * Attests that the subject holds one or more objects, or fails */ public void isNotEmpty() { if (getSubject().isEmpty()) { fail("is not empty"); } }
public void hasValue(V key) { if (!getSubject().containsValue(key)) { fail("has value", key); } }
@Override public void withValue(V expected) { V actual = getSubject().get(key); if ((actual == null && expected != null) || !(actual == expected || actual.equals(expected))) { fail("has key/value pair", Arrays.asList(key, expected), "actually has key/value pair", Arrays.asList(key, actual)); } } };
public void lacksKey(K key) { if (getSubject().containsKey(key)) { fail("lacks key", key); } }
/** * Attests that the subject holds no objects, or fails. */ public void isEmpty() { if (!getSubject().isEmpty()) { fail("is empty"); } }
/** * Attests that the subject contains the provided key or fails. */ public WithValue<V> hasKey(final K key) { if (!getSubject().containsKey(key)) { fail("has key", key); } return new WithValue<V>() { @Override public void withValue(V expected) { V actual = getSubject().get(key); if ((actual == null && expected != null) || !(actual == expected || actual.equals(expected))) { fail("has key/value pair", Arrays.asList(key, expected), "actually has key/value pair", Arrays.asList(key, actual)); } } }; }