Use java 11 (#1050)

This commit is contained in:
Leon Mak
2019-10-28 23:02:17 +08:00
committed by Ilkka Seppälä
parent 6bb3438965
commit dd971d8c19
12 changed files with 102 additions and 141 deletions

View File

@ -40,17 +40,17 @@ public class TreasureChest {
* Constructor
*/
public TreasureChest() {
items = new ArrayList<>();
items.add(new Item(ItemType.POTION, "Potion of courage"));
items.add(new Item(ItemType.RING, "Ring of shadows"));
items.add(new Item(ItemType.POTION, "Potion of wisdom"));
items.add(new Item(ItemType.POTION, "Potion of blood"));
items.add(new Item(ItemType.WEAPON, "Sword of silver +1"));
items.add(new Item(ItemType.POTION, "Potion of rust"));
items.add(new Item(ItemType.POTION, "Potion of healing"));
items.add(new Item(ItemType.RING, "Ring of armor"));
items.add(new Item(ItemType.WEAPON, "Steel halberd"));
items.add(new Item(ItemType.WEAPON, "Dagger of poison"));
items = List.of(
new Item(ItemType.POTION, "Potion of courage"),
new Item(ItemType.RING, "Ring of shadows"),
new Item(ItemType.POTION, "Potion of wisdom"),
new Item(ItemType.POTION, "Potion of blood"),
new Item(ItemType.WEAPON, "Sword of silver +1"),
new Item(ItemType.POTION, "Potion of rust"),
new Item(ItemType.POTION, "Potion of healing"),
new Item(ItemType.RING, "Ring of armor"),
new Item(ItemType.WEAPON, "Steel halberd"),
new Item(ItemType.WEAPON, "Dagger of poison"));
}
public Iterator<Item> iterator(ItemType itemType) {

View File

@ -28,7 +28,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.fail;
import com.iluwatar.iterator.Iterator;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
@ -46,18 +45,18 @@ public class TreasureChestTest {
* @return The set of all expected items in the chest
*/
public static List<Object[]> dataProvider() {
final List<Object[]> parameters = new ArrayList<>();
parameters.add(new Object[]{new Item(ItemType.POTION, "Potion of courage")});
parameters.add(new Object[]{new Item(ItemType.RING, "Ring of shadows")});
parameters.add(new Object[]{new Item(ItemType.POTION, "Potion of wisdom")});
parameters.add(new Object[]{new Item(ItemType.POTION, "Potion of blood")});
parameters.add(new Object[]{new Item(ItemType.WEAPON, "Sword of silver +1")});
parameters.add(new Object[]{new Item(ItemType.POTION, "Potion of rust")});
parameters.add(new Object[]{new Item(ItemType.POTION, "Potion of healing")});
parameters.add(new Object[]{new Item(ItemType.RING, "Ring of armor")});
parameters.add(new Object[]{new Item(ItemType.WEAPON, "Steel halberd")});
parameters.add(new Object[]{new Item(ItemType.WEAPON, "Dagger of poison")});
return parameters;
return List.of(
new Object[]{new Item(ItemType.POTION, "Potion of courage")},
new Object[]{new Item(ItemType.RING, "Ring of shadows")},
new Object[]{new Item(ItemType.POTION, "Potion of wisdom")},
new Object[]{new Item(ItemType.POTION, "Potion of blood")},
new Object[]{new Item(ItemType.WEAPON, "Sword of silver +1")},
new Object[]{new Item(ItemType.POTION, "Potion of rust")},
new Object[]{new Item(ItemType.POTION, "Potion of healing")},
new Object[]{new Item(ItemType.RING, "Ring of armor")},
new Object[]{new Item(ItemType.WEAPON, "Steel halberd")},
new Object[]{new Item(ItemType.WEAPON, "Dagger of poison")}
);
}
/**