package model; import static org.junit.jupiter.api.Assertions.assertEquals; public class MockObserver implements Observer { 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; } }