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)
| 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. |