changes as per review (#6341)

* [BAEL-2471] Guide to Apache Commons MultiValuedMap

* Update MultiValuedMapUnitTest.java

* added empty lines

* updated as per review comments

* changes as per review
This commit is contained in:
anuraggoyal1 2019-02-18 21:14:38 +05:30 committed by Josh Cummings
parent 6c237aaf3a
commit 96fbef6a14
1 changed files with 9 additions and 4 deletions

View File

@ -9,8 +9,10 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.collections4.MultiMapUtils;
import org.apache.commons.collections4.MultiSet;
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
@ -65,25 +67,28 @@ public class MultiValuedMapUnitTest {
@Test
public void givenMultiValuesMap_whenUsingKeysMethod_thenReturningAllKeys() {
MultiValuedMap<String, String> map = new ArrayListValuedHashMap<>();
map.put("fruits", "apple");
map.put("fruits", "orange");
map.put("vehicles", "car");
map.put("vehicles", "bike");
assertThat(((Collection<String>) map.keys())).contains("fruits", "vehicles");
MultiSet<String> keys = map.keys();
assertThat((keys)).contains("fruits", "vehicles");
}
@Test
public void givenMultiValuesMap_whenUsingKeySetMethod_thenReturningAllKeys() {
MultiValuedMap<String, String> map = new ArrayListValuedHashMap<>();
map.put("fruits", "apple");
map.put("fruits", "orange");
map.put("vehicles", "car");
map.put("vehicles", "bike");
assertThat((Collection<String>) map.keySet()).contains("fruits", "vehicles");
Set<String> keys = map.keySet();
assertThat(keys).contains("fruits", "vehicles");
}