@Test public void testWithTabsSuccess() throws Exception { String script = "\tconnect 'tcp: "connected\n" + "close\n" + "\t\tclosed\n"; ScriptParser parser = new ScriptParserImpl(); AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); String observedScript = progress.getObservedScript(); assertEquals(script, observedScript); }
public String getObservedScript() { if (observeredScript == null) { int numberOfFailures = failureInfos.size(); if (numberOfFailures == 0) { observeredScript = expectedScript; } else { StringBuilder builder = new StringBuilder(); processRegion(builder, scriptInfo, failureInfos); if (numberOfFailures <= failureInfos.size()) { throw new RuntimeException("Script failure detected but not located"); } observeredScript = builder.toString(); } } return observeredScript; }
ScriptProgress { public String getObservedScript() { if (observeredScript == null) { int numberOfFailures = failureInfos.size(); if (numberOfFailures == 0) { observeredScript = expectedScript; } else { StringBuilder builder = new StringBuilder(); processRegion(builder, scriptInfo, failureInfos); if (numberOfFailures <= failureInfos.size()) { throw new RuntimeException("Script failure detected but not located"); } observeredScript = builder.toString(); } } return observeredScript; } }
ScriptProgress { public String getObservedScript() { if (observeredScript == null) { int numberOfFailures = failureInfos.size(); if (numberOfFailures == 0) { observeredScript = expectedScript; } else { StringBuilder builder = new StringBuilder(); processRegion(builder, scriptInfo, failureInfos); if (numberOfFailures <= failureInfos.size()) { throw new RuntimeException("Script failure detected but not located"); } observeredScript = builder.toString(); } } return observeredScript; } ScriptProgress(RegionInfo scriptInfo, String expectedScript); }
ScriptProgress { public String getObservedScript() { if (observeredScript == null) { int numberOfFailures = failureInfos.size(); if (numberOfFailures == 0) { observeredScript = expectedScript; } else { StringBuilder builder = new StringBuilder(); processRegion(builder, scriptInfo, failureInfos); if (numberOfFailures <= failureInfos.size()) { throw new RuntimeException("Script failure detected but not located"); } observeredScript = builder.toString(); } } return observeredScript; } ScriptProgress(RegionInfo scriptInfo, String expectedScript); void addScriptFailure(RegionInfo regionInfo); void addScriptFailure(RegionInfo regionInfo, String message); String getExpectedScript(); RegionInfo getScriptInfo(); String getObservedScript(); }
ScriptProgress { public String getObservedScript() { if (observeredScript == null) { int numberOfFailures = failureInfos.size(); if (numberOfFailures == 0) { observeredScript = expectedScript; } else { StringBuilder builder = new StringBuilder(); processRegion(builder, scriptInfo, failureInfos); if (numberOfFailures <= failureInfos.size()) { throw new RuntimeException("Script failure detected but not located"); } observeredScript = builder.toString(); } } return observeredScript; } ScriptProgress(RegionInfo scriptInfo, String expectedScript); void addScriptFailure(RegionInfo regionInfo); void addScriptFailure(RegionInfo regionInfo, String message); String getExpectedScript(); RegionInfo getScriptInfo(); String getObservedScript();  }