public static void assertTrace(List<String> expected, Trace trace) {
        String actual = trace.toString();
        for (int i = 0, pos = -1; i < expected.size(); ++i) {
            String line = expected.get(i).replaceFirst("\\$\\{VERSION\\}", Vtag.currentVersion.toString());
            if (line.charAt(0) == '-') {
                String str = line.substring(1);
                assertTrue(actual.indexOf(str, pos + 1) < 0,
                           "Line " + i + " '" + str + "' not expected.");
            } else {
                pos = actual.indexOf(line, pos + 1);
                assertTrue(pos >= 0, "Line " + i + " '" + line + "' missing.");
            }
        }
    }
@author havardpe
@author Simon Thoresen Hult
messagebus/src/test/java/com/yahoo/messagebus/routing/RoutingTestCase.java