@Test
public void testPumpBasic() throws Exception {
FakeReadStream<MyClass> rs = new FakeReadStream<>();
FakeWriteStream<MyClass> ws = new FakeWriteStream<>();
Pump p = Pump.pump(rs, ws, 1001);
for (int i = 0; i < 10; i++) { // Repeat a few times
p.start();
List<MyClass> inp = new ArrayList<>();
for (int j = 0; j < 10; j++) {
MyClass myClass = new MyClass();
inp.add(myClass);
rs.addData(myClass);
}
assertEquals(inp, ws.received);
assertFalse(rs.paused);
assertEquals(0, rs.pauseCount);
assertEquals(0, rs.resumeCount);
p.stop();
ws.clearReceived();
MyClass myClass = new MyClass();
rs.addData(myClass);
assertEquals(0, ws.received.size());
}