Created
December 14, 2019 07:18
-
-
Save mchmielarz/bbca896f975e50898f8e5c0f7a385246 to your computer and use it in GitHub Desktop.
New assertions added to MapAssert in assertj-vavr v0.2.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
// given | |
private static final Tuple2<String, String> FRODO = Tuple.of("frodo", "hobbit"); | |
private static final Tuple2<String, String> GIMLI = Tuple.of("gimli", "dwarf"); | |
private static final Tuple2<String, String> LEGOLAS = Tuple.of("legolas", "elf"); | |
private static final Map<String, String> PERSONS = List.of(FRODO, GIMLI, LEGOLAS).toMap(tup -> tup); | |
// somewhere in tests | |
assertThat(PERSONS) | |
.containsOnly(List.of(FRODO, GIMLI, LEGOLAS)) | |
.containsOnlyKeys(FRODO._1, GIMLI._1, LEGOLAS._1) | |
.containsKey("frodo") | |
.containsKeys("frodo", "legolas") | |
.containsValue("dwarf") | |
.containsValues("elf", "dwarf") | |
.doesNotContainKey("aragorn") | |
.doesNotContainKeys("aragorn", "boromir") | |
.doesNotContainValue("man") | |
.doesNotContainValues("man", "orc"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment