Skip to content

Instantly share code, notes, and snippets.

@riking
Created May 17, 2014 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riking/1e4496e2a6d52abf1440 to your computer and use it in GitHub Desktop.
Save riking/1e4496e2a6d52abf1440 to your computer and use it in GitHub Desktop.
while ((line = fileReader.readLine()) != null) {
if (line.isEmpty()) continue;
String[] args = new StrTokenizer(line, StrMatcher.splitMatcher())
.setTrimmerMatcher(StrMatcher.trimMatcher())
.getTokenArray();
ActionHandler.ActionResult actionResult;
try {
actionResult = handler.doAction(this, args, line);
@Override
public ActionResult doAction(Tester tester, String[] args, String fullLine) throws Exception {
String command = args[0];
if (command.equals("O")) {
System.err.println("HISAFDSALJFJKEW");
String required = "\"" + fullLine.substring(fullLine.indexOf(' ')) + "\"";
System.out.println(required);
String line;
Matcher matcher;
do {
line = tester.getLine();
matcher = messagePattern.matcher(line);
} while (!matcher.matches() && outputSkipAllowed);
outputSkipAllowed = false;
if (!matcher.matches()) {
fail(tester, line + " is not a proper message");
}
// String level = matcher.group(1);
String message = matcher.group(2);
System.out.println(message);
message = message.replaceAll(colorPattern, "");
System.out.println(message);
if (!required.equals(message)) {
fail(tester, "Expected " + required + ", got " + message);
}
return ActionResult.NORMAL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment