@Test
public void testMultipleInputStreamStatusToggling() {

	BufferedValveOutputHandler valveOutput = new BufferedValveOutputHandler();
	StatusWatermarkValve valve = new StatusWatermarkValve(2, valveOutput);
	// this also implicitly verifies that all input channels start as active
	valve.inputStreamStatus(StreamStatus.ACTIVE, 0);
	valve.inputStreamStatus(StreamStatus.ACTIVE, 1);
	assertEquals(null, valveOutput.popLastSeenOutput());
	valve.inputStreamStatus(StreamStatus.IDLE, 1);
	assertEquals(null, valveOutput.popLastSeenOutput());
	// now, all channels are IDLE
	valve.inputStreamStatus(StreamStatus.IDLE, 0);
	assertEquals(StreamStatus.IDLE, valveOutput.popLastSeenOutput());
	valve.inputStreamStatus(StreamStatus.IDLE, 0);
	valve.inputStreamStatus(StreamStatus.IDLE, 1);
	assertEquals(null, valveOutput.popLastSeenOutput());
	// as soon as at least one input becomes active again, the ACTIVE marker should be forwarded
	valve.inputStreamStatus(StreamStatus.ACTIVE, 1);
	assertEquals(StreamStatus.ACTIVE, valveOutput.popLastSeenOutput());
	valve.inputStreamStatus(StreamStatus.ACTIVE, 0);
	// already back to ACTIVE, should yield no output
	assertEquals(null, valveOutput.popLastSeenOutput());
}