Source:
<code>private Optional<Boolean> parse(List<String> test, String name) { List<String> id = new ArrayList<>(); Iterator<String> iter = test.iterator(); while (iter.hasNext()) { String line = iter.next(); String[] args = line.split("%%"); switch (args[0]) { case "subscribe": handleSubscribe(args); id.add(args[2]); break; case "channel": handleChannel(args, iter, name); break; case "echochannel": handleEchoChannel(args); break; case "await": switch (args[1]) { case "terminal": handleAwaitTerminal(args); break; case "atLeast": handleAwaitAtLeast(args); break; case "no_events": handleAwaitNoEvents(args); break; default: break; } break; case "assert": switch (args[1]) { case "no_error": handleNoError(args); break; case "error": handleError(args); break; case "received": handleReceived(args); break; case "received_n": handleReceivedN(args); break; case "received_at_least": handleReceivedAtLeast(args); break; case "completed": handleCompleted(args); break; case "no_completed": handleNoCompleted(args); break; case "canceled": handleCancelled(args); break; } break; case "take": handleTake(args); break; case "request": handleRequest(args); break; case "cancel": handleCancel(args); break; case "EOF": break; default: break; } } if (id.size() > 0) { boolean hasPassed = true; for (String str : id) { if (payloadSubscribers.get(str) != null) hasPassed = hasPassed && payloadSubscribers.get(str).hasPassed(); else hasPassed = hasPassed && fnfSubscribers.get(str).hasPassed(); } return Optional.of(hasPassed); } <START> else return Optional.empty(); <END> }</code><technical_language>a return type boolean, exception for id.size() == 0</technical_language>

Target:
private TestResult parse(List<String> test, String name) throws Exception { List<String> id = new ArrayList<>(); Iterator<String> iter = test.iterator(); boolean shouldPass = true; boolean channelTest = false; while (iter.hasNext()) { String line = iter.next(); String[] args = line.split("%%"); switch (args[0]) { case "subscribe": handleSubscribe(args); id.add(args[2]); break; case "channel": channelTest = true; handleChannel(args, iter, name); break; case "echochannel": handleEchoChannel(args); break; case "await": switch (args[1]) { case "terminal": handleAwaitTerminal(args); break; case "atLeast": handleAwaitAtLeast(args); break; case "no_events": handleAwaitNoEvents(args); break; default: break; } break; case "assert": switch (args[1]) { case "no_error": handleNoError(args); break; case "error": handleError(args); break; case "received": handleReceived(args); break; case "received_n": handleReceivedN(args); break; case "received_at_least": handleReceivedAtLeast(args); break; case "completed": handleCompleted(args); break; case "no_completed": handleNoCompleted(args); break; case "canceled": handleCancelled(args); break; } break; case "take": handleTake(args); break; case "request": handleRequest(args); break; case "cancel": handleCancel(args); break; case "EOF": break; case "pass": shouldPass = true; break; case "fail": shouldPass = false; break; default: break; } } if (id.size() > 0) { boolean hasPassed = true; for (String str : id) { if (payloadSubscribers.get(str) != null) hasPassed = hasPassed && payloadSubscribers.get(str).hasPassed(); else hasPassed = hasPassed && fnfSubscribers.get(str).hasPassed(); } if ((shouldPass && hasPassed) || (!shouldPass && !hasPassed)) return TestResult.PASS; else return TestResult.FAIL; } else if (channelTest) return TestResult.CHANNEL; else throw new Exception("There is no subscriber in this test"); }