MCPcopy Index your code
hub / github.com/assertj/assertj / assertContainsKeys

Method assertContainsKeys

src/main/java/org/assertj/core/internal/Maps.java:245–257  ·  view source on GitHub ↗

Verifies that the actual map contain the given key. @param info contains information about the assertion. @param actual the given Map. @param keys the given keys @throws AssertionError if the actual map is null. @throws AssertionError if the actual map not contains the given key.

(AssertionInfo info, Map<K, V> actual, @SuppressWarnings("unchecked") K... keys)

Source from the content-addressed store, hash-verified

243 * @throws AssertionError if the actual map not contains the given key.
244 */
245 public <K, V> void assertContainsKeys(AssertionInfo info, Map<K, V> actual, @SuppressWarnings("unchecked") K... keys) {
246 assertNotNull(info, actual);
247 Set<K> notFound = new LinkedHashSet<K>();
248 for (K key : keys) {
249 if (!actual.containsKey(key)) {
250 notFound.add(key);
251 }
252 }
253 if (notFound.isEmpty()) {
254 return;
255 }
256 throw failures.failure(info, shouldContainKeys(actual, notFound));
257 }
258
259 /**
260 * Verifies that the actual map not contains the given key.

Calls 5

assertNotNullMethod · 0.95
containsKeyMethod · 0.80
shouldContainKeysMethod · 0.80
isEmptyMethod · 0.65
failureMethod · 0.45