/** * Verifies that the actual value is a map, and returns a map assertion, to allow * chaining of map-specific assertions from this call. * @return a map assertion object */ @SuppressWarnings("unchecked") public AbstractMapAssert<?, ?, Object, Object> asMap() { Objects.instance().assertIsInstanceOf(this.info, this.actual, Map.class); return Assertions.assertThat((Map<Object, Object>) this.actual); }
/** * Delegate call to {@link org.assertj.core.api.Assertions#assertThat(Map)} */ default <K, V> AbstractMapAssert<?, ? extends Map<K, V>, K, V> then(Map<K, V> actual) { fluentBdd().verification.recordThen(this); return DELEGATE.assertThat(actual); }
/** * Delegate call to {@link org.assertj.core.api.Assertions#assertThat(Map)} */ default <K, V> AbstractMapAssert<?, ? extends Map<K, V>, K, V> and(Map<K, V> actual) { fluentBdd().verification.recordThen(this); return DELEGATE.assertThat(actual); }
/** * Extract the map value at the given JSON path for further object assertions. * @param expression the {@link JsonPath} expression * @param args arguments to parameterize the {@code JsonPath} expression with, using * formatting specifiers defined in {@link String#format(String, Object...)} * @return a new assertion object whose object under test is the extracted item * @throws AssertionError if the path is not valid or does not result in a map */ @SuppressWarnings("unchecked") public AbstractMapAssert<?, ?, Object, Object> extractingJsonPathMapValue( CharSequence expression, Object... args) { return Assertions.assertThat( extractingJsonPathValue(expression, args, Map.class, "a map")); }
/** * A little wrapper over {@code assertThat} that just mention that this what we expect from the test. So if the * expectation fails, it's probably the test that is wrong, not the implementation. * * @param actual actual value * @return an AssertJ assertion */ protected static <K, V> AbstractMapAssert<?, ? extends Map<K, V>, K, V> expect(Map<K, V> actual) { return assertThat(actual); }