Add java 11 support for #987 (o-t) (#1051)

* Use java 11

* Use .of
- Replace Arrays.asList with List.of
- Replace HashSet<>(List.of()) with Set.of

* Formatting
This commit is contained in:
Leon Mak
2019-10-29 14:37:40 +08:00
committed by Ilkka Seppälä
parent dd971d8c19
commit c8a481bb77
37 changed files with 176 additions and 257 deletions

View File

@ -23,7 +23,6 @@
package com.iluwatar.observer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -36,12 +35,11 @@ public class HobbitsTest extends WeatherObserverTest<Hobbits> {
@Override
public Collection<Object[]> dataProvider() {
final List<Object[]> testData = new ArrayList<>();
testData.add(new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."});
testData.add(new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."});
testData.add(new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."});
testData.add(new Object[]{WeatherType.COLD, "The hobbits are shivering in the cold weather."});
return testData;
return List.of(
new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."},
new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."},
new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."},
new Object[]{WeatherType.COLD, "The hobbits are shivering in the cold weather."});
}
/**

View File

@ -23,7 +23,6 @@
package com.iluwatar.observer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -36,12 +35,11 @@ public class OrcsTest extends WeatherObserverTest<Orcs> {
@Override
public Collection<Object[]> dataProvider() {
final List<Object[]> testData = new ArrayList<>();
testData.add(new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."});
testData.add(new Object[]{WeatherType.RAINY, "The orcs are dripping wet."});
testData.add(new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."});
testData.add(new Object[]{WeatherType.COLD, "The orcs are freezing cold."});
return testData;
return List.of(
new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."},
new Object[]{WeatherType.RAINY, "The orcs are dripping wet."},
new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."},
new Object[]{WeatherType.COLD, "The orcs are freezing cold."});
}
/**

View File

@ -25,7 +25,6 @@ package com.iluwatar.observer.generic;
import com.iluwatar.observer.WeatherType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -38,12 +37,12 @@ public class GHobbitsTest extends ObserverTest<GHobbits> {
@Override
public Collection<Object[]> dataProvider() {
final List<Object[]> testData = new ArrayList<>();
testData.add(new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."});
testData.add(new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."});
testData.add(new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."});
testData.add(new Object[]{WeatherType.COLD, "The hobbits are shivering in the cold weather."});
return testData;
return List.of(
new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."},
new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."},
new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."},
new Object[]{WeatherType.COLD, "The hobbits are shivering in the cold weather."}
);
}
/**

View File

@ -25,7 +25,6 @@ package com.iluwatar.observer.generic;
import com.iluwatar.observer.WeatherType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -38,12 +37,12 @@ public class OrcsTest extends ObserverTest<GOrcs> {
@Override
public Collection<Object[]> dataProvider() {
final List<Object[]> testData = new ArrayList<>();
testData.add(new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."});
testData.add(new Object[]{WeatherType.RAINY, "The orcs are dripping wet."});
testData.add(new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."});
testData.add(new Object[]{WeatherType.COLD, "The orcs are freezing cold."});
return testData;
return List.of(
new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."},
new Object[]{WeatherType.RAINY, "The orcs are dripping wet."},
new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."},
new Object[]{WeatherType.COLD, "The orcs are freezing cold."}
);
}
/**