public void testFilter() throws Exception {
// Test string
final String test = "3.yes,1.A;2.no,1.B;3.yes,1.C;3.yes,1.D;4.nope,1.E;";
GuacamoleReader reader = new FilteredGuacamoleReader(new ReaderGuacamoleReader(new StringReader(test)),
new TestFilter());
GuacamoleInstruction instruction;
// Validate first instruction
instruction = reader.readInstruction();
assertNotNull(instruction);
assertEquals("yes", instruction.getOpcode());
assertEquals(1, instruction.getArgs().size());
assertEquals("A", instruction.getArgs().get(0));
// Validate second instruction
instruction = reader.readInstruction();
assertNotNull(instruction);
assertEquals("yes", instruction.getOpcode());
assertEquals(1, instruction.getArgs().size());
assertEquals("C", instruction.getArgs().get(0));
// Validate third instruction
instruction = reader.readInstruction();
assertNotNull(instruction);
assertEquals("yes", instruction.getOpcode());
assertEquals(1, instruction.getArgs().size());
assertEquals("D", instruction.getArgs().get(0));
// Should be done now
instruction = reader.readInstruction();
assertNull(instruction);
}