Last active
March 12, 2019 15:39
-
-
Save mchmielarz/898811b96a00142946e62b533180c9a8 to your computer and use it in GitHub Desktop.
Capabilities of MapAssert from assertj-vavr v0.1.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Map<String, String> cars = HashMap.of( | |
"electric", "Tesla Model 3", | |
"gasoline", "Audi A4 Quattro", | |
"diesel", "Peugeot 308SW" | |
); | |
final Map<String, String> expected = cars; | |
assertThat(cars) | |
.isNotEmpty() | |
.hasSize(3) | |
.isEqualTo(expected) // assuming it contains the same values as cars | |
.contains( | |
Tuple.of("gasoline", "Audi A4 Quattro"), Tuple.of("diesel", "Peugeot 308SW") | |
) | |
.containsEntry("electric", "Tesla Model 3") | |
.containsAnyOf( | |
Tuple.of("nuclear", "DeLorean DMC-12"), Tuple.of("diesel", "Peugeot 308SW") | |
) | |
.containsAllEntriesOf( | |
List.of(Tuple.of("gasoline", "Audi A4 Quattro"), | |
Tuple.of("diesel", "Peugeot 308SW")) | |
) | |
.doesNotContain(Tuple.of("nuclear", "DeLorean DMC-12")) | |
.doesNotContainEntry("nuclear", "DeLorean DMC-12"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment