-
Notifications
You must be signed in to change notification settings - Fork 6
/
ArrayQueueToArrayTest.java
34 lines (27 loc) · 1.05 KB
/
ArrayQueueToArrayTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package queue;
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.Deque;
/**
* @author Georgiy Korneev ([email protected])
*/
public class ArrayQueueToArrayTest extends ArrayQueueTest<ArrayQueueToArrayTest.ToArrayQueue> {
public ArrayQueueToArrayTest() {
super(ToArrayQueue::new);
}
public static void main(final String[] args) {
new ArrayQueueToArrayTest().test();
}
@Override
protected void linearTest(final Deque<Object> expected, final ToArrayQueue actual) {
assertEquals("toArray()", Arrays.asList(expected.toArray()), Arrays.asList(actual.toArray()));
}
static class ToArrayQueue extends ArrayQueueTest.Queue {
private final ZMethod<Object[]> toArray;
public ToArrayQueue(final String className, final Mode mode) throws MalformedURLException, NoSuchMethodException, ClassNotFoundException {
super(className, mode);
toArray = findMethod("toArray");
}
public Object[] toArray() { return toArray.invoke(); }
}
}