[BAEL-18364] move spring-rest-*** articles - 1

This commit is contained in:
Sjmillington
2019-10-17 17:17:31 +01:00
parent db85c8f275
commit f1673ce653
20415 changed files with 1639515 additions and 0 deletions
@@ -0,0 +1,27 @@
package com.baeldung.map;
import org.junit.Test;
import java.util.Collections;
import java.util.Map;
import static org.junit.Assert.*;
public class KeyCheckUnitTest {
@Test
public void whenKeyIsPresent_thenContainsKeyReturnsTrue() {
Map<String, String> map = Collections.singletonMap("key", "value");
assertTrue(map.containsKey("key"));
assertFalse(map.containsKey("missing"));
}
@Test
public void whenKeyHasNullValue_thenGetStillWorks() {
Map<String, String> map = Collections.singletonMap("nothing", null);
assertTrue(map.containsKey("nothing"));
assertNull(map.get("nothing"));
}
}