Last active
January 2, 2019 05:49
-
-
Save hugomarques/a6d05f7154f464bb047c4803678a7781 to your computer and use it in GitHub Desktop.
Revisions
-
hugomarques revised this gist
Jan 2, 2019 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,13 +7,14 @@ import static org.assertj.core.api.Assertions.assertThat; /** * Samples how to use AssertJ to test a Map. * @author hugomarques * 10/22/16. */ public class AssertJMapTest { @Test public void testMapsAreTheSame() { ImmutableMap<String, String> expectedCreatureByType = ImmutableMap.of( "Red Dragon", "Dragon", "Vampire","undead", @@ -27,7 +28,7 @@ public void testAssertMap() { } @Test public void testDifferentAssertJMatchers() { ImmutableMap<String, String> expectedCreatureByType = ImmutableMap.of( "Red Dragon", "Dragon", "Vampire","undead", -
hugomarques created this gist
Oct 23, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ package com.hugodesmarques.assertJ; import com.google.common.collect.ImmutableMap; import org.apache.commons.lang3.SerializationUtils; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; /** * @author hugomarques * 10/22/16. */ public class AssertJMapTest { @Test public void testAssertMap() { ImmutableMap<String, String> expectedCreatureByType = ImmutableMap.of( "Red Dragon", "Dragon", "Vampire","undead", "Ghoul","undead", "Cloud Giant","Giant" ); ImmutableMap<String, String> clonedMap = SerializationUtils.clone(expectedCreatureByType); assertThat(expectedCreatureByType) .containsAllEntriesOf(clonedMap); } @Test public void testAssertRandom() { ImmutableMap<String, String> expectedCreatureByType = ImmutableMap.of( "Red Dragon", "Dragon", "Vampire","undead", "Ghoul","undead", "Cloud Giant","Giant" ); assertThat(expectedCreatureByType.get("Unicorn")) .isNull(); assertThat(expectedCreatureByType.get("Vampire")) .isNotNull(); assertThat(expectedCreatureByType.get("Vampire")) .isEqualToIgnoringCase("UNDEAD"); } }