}
public void testProcess() {
final ArrayBlockingQueue<String> requests = new ArrayBlockingQueue<String>(1);
final ArrayBlockingQueue<ShellProcessContext> contexts = new ArrayBlockingQueue<ShellProcessContext>(1);
shell.addProcess(new SyncProcess() {
@Override
public void run(String request, ShellProcessContext context) throws Exception {
requests.add(request);
contexts.add(context);
}
});
console.init();
console.on(KeyStrokes.a);
console.on(KeyStrokes.ENTER);
console.on(KeyStrokes.b);
console.on(KeyStrokes.ENTER);
assertEquals("a", requests.poll());
ShellProcessContext context = contexts.poll();
assertNotNull(context);
shell.addProcess(new SyncProcess() {
@Override
public void run(String request, ShellProcessContext context) throws Exception {
contexts.add(context);
}
});