public void testKbdInputBuffer() throws Exception { Application app = new Application(null, null, null); app.setKbd("3 45 67"); assertEquals(app.readNextFromKbd(), 3); assertEquals(app.readNextFromKbd(), 45); assertEquals(app.readNextFromKbd(), 67); try { app.readNextFromKbd(); fail("Should have thrown an exception now: no more data."); } catch (TTK91NoKbdData err) { } app.setKbd("-3 ;: 6;:\n\r\n7"); assertEquals(app.readNextFromKbd(), -3); assertEquals(app.readNextFromKbd(), 6); assertEquals(app.readNextFromKbd(), 7); try { app.readNextFromKbd(); fail("Should have thrown an exception now: no more data."); } catch (TTK91NoKbdData err) { } try { app.setKbd("-3 5 a"); fail("Should have thrown an exception now: invalid input."); } catch (IllegalArgumentException err) { } }