Add java 11 (#1048)

This commit is contained in:
Leon Mak
2019-10-28 04:05:10 +08:00
committed by Ilkka Seppälä
parent b50189e283
commit 63fb8dc318
11 changed files with 119 additions and 145 deletions

View File

@ -31,9 +31,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
/**
* AbstractDocument test class
@ -60,9 +58,7 @@ public class AbstractDocumentTest {
@Test
public void shouldRetrieveChildren() {
Map<String, Object> child1 = new HashMap<>();
Map<String, Object> child2 = new HashMap<>();
List<Map<String, Object>> children = Arrays.asList(child1, child2);
var children = List.of(Map.of(), Map.of());
document.put(KEY, children);
@ -80,8 +76,7 @@ public class AbstractDocumentTest {
@Test
public void shouldIncludePropsInToString() {
Map<String, Object> props = new HashMap<>();
props.put(KEY, VALUE);
Map<String, Object> props = Map.of(KEY, VALUE);
DocumentImplementation document = new DocumentImplementation(props);
assertTrue(document.toString().contains(KEY));
assertTrue(document.toString().contains(VALUE));

View File

@ -23,17 +23,16 @@
package com.iluwatar.abstractdocument;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Test;
import com.iluwatar.abstractdocument.domain.Car;
import com.iluwatar.abstractdocument.domain.Part;
import com.iluwatar.abstractdocument.domain.enums.Property;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Test for Part and Car
@ -49,10 +48,10 @@ public class DomainTest {
@Test
public void shouldConstructPart() {
Map<String, Object> partProperties = new HashMap<>();
partProperties.put(Property.TYPE.toString(), TEST_PART_TYPE);
partProperties.put(Property.MODEL.toString(), TEST_PART_MODEL);
partProperties.put(Property.PRICE.toString(), TEST_PART_PRICE);
Map<String, Object> partProperties = Map.of(
Property.TYPE.toString(), TEST_PART_TYPE,
Property.MODEL.toString(), TEST_PART_MODEL,
Property.PRICE.toString(), TEST_PART_PRICE);
Part part = new Part(partProperties);
assertEquals(TEST_PART_TYPE, part.getType().get());
@ -62,10 +61,10 @@ public class DomainTest {
@Test
public void shouldConstructCar() {
Map<String, Object> carProperties = new HashMap<>();
carProperties.put(Property.MODEL.toString(), TEST_CAR_MODEL);
carProperties.put(Property.PRICE.toString(), TEST_CAR_PRICE);
carProperties.put(Property.PARTS.toString(), Arrays.asList(new HashMap<>(), new HashMap<>()));
Map<String, Object> carProperties = Map.of(
Property.MODEL.toString(), TEST_CAR_MODEL,
Property.PRICE.toString(), TEST_CAR_PRICE,
Property.PARTS.toString(), List.of(new HashMap<>(), new HashMap<>()));
Car car = new Car(carProperties);
assertEquals(TEST_CAR_MODEL, car.getModel().get());