Add java 11 (#1048)
This commit is contained in:
@ -23,10 +23,8 @@
|
||||
|
||||
package com.iluwatar.commander;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
import com.iluwatar.commander.exceptions.DatabaseUnavailableException;
|
||||
|
||||
/**
|
||||
@ -49,7 +47,7 @@ public abstract class Service {
|
||||
|
||||
protected Service(Database db, Exception...exc) {
|
||||
this.database = db;
|
||||
this.exceptionsList = new ArrayList<Exception>(Arrays.asList(exc));
|
||||
this.exceptionsList = new ArrayList<>(List.of(exc));
|
||||
}
|
||||
|
||||
public abstract String receiveRequest(Object...parameters) throws DatabaseUnavailableException;
|
||||
|
@ -23,12 +23,13 @@
|
||||
|
||||
package com.iluwatar.commander.queue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import com.iluwatar.commander.Database;
|
||||
import com.iluwatar.commander.exceptions.DatabaseUnavailableException;
|
||||
import com.iluwatar.commander.exceptions.IsEmptyException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* QueueDatabase id where the instructions to be implemented are queued.
|
||||
*/
|
||||
@ -39,8 +40,8 @@ public class QueueDatabase extends Database<QueueTask> {
|
||||
public ArrayList<Exception> exceptionsList;
|
||||
|
||||
public QueueDatabase(Exception...exc) {
|
||||
this.data = new Queue<QueueTask>();
|
||||
this.exceptionsList = new ArrayList<Exception>(Arrays.asList(exc));
|
||||
this.data = new Queue<>();
|
||||
this.exceptionsList = new ArrayList<>(List.of(exc));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,18 +23,14 @@
|
||||
|
||||
package com.iluwatar.commander;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.iluwatar.commander.Order;
|
||||
import com.iluwatar.commander.Retry;
|
||||
import com.iluwatar.commander.User;
|
||||
import com.iluwatar.commander.Retry.HandleErrorIssue;
|
||||
import com.iluwatar.commander.Retry.Operation;
|
||||
import com.iluwatar.commander.exceptions.DatabaseUnavailableException;
|
||||
import com.iluwatar.commander.exceptions.ItemUnavailableException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class RetryTest {
|
||||
|
||||
@ -55,15 +51,15 @@ class RetryTest {
|
||||
e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass()));
|
||||
User user = new User("Jim", "ABCD");
|
||||
Order order = new Order(user, "book", 10f);
|
||||
ArrayList<Exception> arr1 = new ArrayList<Exception>(Arrays.asList(new Exception[]
|
||||
{new ItemUnavailableException(), new DatabaseUnavailableException()}));
|
||||
ArrayList<Exception> arr1 = new ArrayList<>(List.of(
|
||||
new ItemUnavailableException(), new DatabaseUnavailableException()));
|
||||
try {
|
||||
r1.perform(arr1, order);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
ArrayList<Exception> arr2 = new ArrayList<Exception>(Arrays.asList(new Exception[]
|
||||
{new DatabaseUnavailableException(), new ItemUnavailableException()}));
|
||||
ArrayList<Exception> arr2 = new ArrayList<>(List.of(
|
||||
new DatabaseUnavailableException(), new ItemUnavailableException()));
|
||||
try {
|
||||
r2.perform(arr2, order);
|
||||
} catch (Exception e1) {
|
||||
|
Reference in New Issue
Block a user