XcodeBuilder extends Builder implements Script { public Element getElementFromLine(String line) { if (hitBuildFailedMessage) { return messageAtLevel(line, "error"); } Element e = messageAtLevelIfContains(line, "warn", " warning: "); if (e != null) { return e; } e = messageAtLevelIfContains(line, "error", " error: "); if (e != null) { return e; } e = messageAtLevelIfContains(line, "error", "** BUILD FAILED **"); if (e != null) { hitBuildFailedMessage = true; return e; } return null; }  @Override Element build(Map<String, String> properties, Progress progressIn); @Override Element buildWithTarget(Map<String, String> properties, String target, Progress progress); @Override void validate(); Commandline buildCommandline(); int getExitCode(); void setExitCode(int result); void setDirectory(String path); Element getElementFromLine(String line); void setTimeout(long timeout); @Description("Pass specified argument to xcodebuild. The element has the required attribute: value.") Arg createArg();  }
@Test public void compileLineShouldNotCreateAnElement() { Element e = builder.getElementFromLine(COMPILE_LINE); assertNull(e); }
@Test public void warningLineShouldReturnWarningElement() { Element e = builder.getElementFromLine(WARNING_LINE); assertMessageAtLevel(WARNING_LINE, e, "warn"); }
@Test public void errorLineShouldReturnErrorElement() { Element e = builder.getElementFromLine(ERROR_LINE); assertMessageAtLevel(ERROR_LINE, e, "error"); }
@Test public void buildFaildShouldReturnErrorElement() { Element e = builder.getElementFromLine(BUILD_FAILED_LINE); assertMessageAtLevel(BUILD_FAILED_LINE, e, "error"); }
@Test public void everythingAfterBuildFailedShouldReturnElement() { Element e = builder.getElementFromLine(COMMANDS_FAILED_LINE); assertNull(e); e = builder.getElementFromLine(BUILD_FAILED_LINE); assertMessageAtLevel(BUILD_FAILED_LINE, e, "error"); e = builder.getElementFromLine(COMMANDS_FAILED_LINE); assertMessageAtLevel(COMMANDS_FAILED_LINE, e, "error"); }