blob: bd3e79fedfa712be745831609580ce99a85da5c2 (
plain)
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
35
36
37
38
39
40
41
|
package model;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class MockObserver<T> implements Observer<T> {
private int countPrev;
private int count;
private T data;
private int dir;
private int index;
@Override
public void accept(T data, int direction, int index) {
this.count++;
this.data = data;
this.dir = direction;
this.index = index;
}
public void assertCalled(int dir) {
assertEquals(countPrev + 1, count);
assertEquals(dir, this.dir);
countPrev = count;
}
public int getCount() {
return count;
}
public T getData() {
return data;
}
public int getDir() {
return dir;
}
public int getIndex() {
return index;
}
}
|