* Hexagonal Architecture in Java
* Refactor Hexagonal Architecture in Java
* Refactor Hexagonal Architecture in Java
* BAEL-5163: HashMap - keySet vs entrySet vs values methods
* BAEL-5163: HashMap - keySet vs entrySet vs values methods
* Revert "Hexagonal Architecture in Java"
This reverts commit 1add21c1
* BAEL-5163: HashMap - keySet vs entrySet vs values methods
* BAEL-5163: HashMap - keySet vs entrySet vs values methods"
28 lines
685 B
Java
28 lines
685 B
Java
package com.baeldung.map.keysetValuesEntrySet;
|
|
|
|
import org.junit.Test;
|
|
|
|
import java.util.Collection;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
public class ValuesExampleUnitTest {
|
|
|
|
@Test
|
|
public void givenHashMap_whenValuesApplied_thenShouldReturnCollectionOfValues() {
|
|
Map<String, Integer> map = new HashMap<>();
|
|
map.put("one", 1);
|
|
map.put("two", 2);
|
|
|
|
Collection<Integer> actualValues = map.values();
|
|
|
|
assertEquals(2, actualValues.size());
|
|
assertTrue(actualValues.contains(1));
|
|
assertTrue(actualValues.contains(2));
|
|
}
|
|
|
|
}
|