@Test public void testGetTextPlaceHolderTestCase() throws Exception { TestCase testCase = new TestCaseExampleBuilder() .withState(TestCaseState.OK) .withTestCaseFile(Paths.get("folder/_tc.js")) .buildExample(); final PlaceholderMap textPlaceholder = testling.getTextPlaceholder(testCase); assertEquals(textPlaceholder.get(STATE), "OK"); assertEquals(textPlaceholder.get(STATE_SHORT), "[OK]"); assertEquals(textPlaceholder.get(STATE_DESC), "ok"); assertEquals(textPlaceholder.get(NAME), testCase.getName()); assertEquals(textPlaceholder.get(ID), testCase.getId()); assertEquals(textPlaceholder.get(DURATION), "3.00"); assertEquals(textPlaceholder.get(STOP_DATE), AbstractOutputBuilder.dateFormat.format(testCase.getStopDate())); assertEquals(textPlaceholder.get(START_DATE), AbstractOutputBuilder.dateFormat.format(testCase.getStartDate())); assertEquals(textPlaceholder.get(WARN_THRESHOLD), "4"); assertEquals(textPlaceholder.get(CRITICAL_THRESHOLD), "5"); assertEquals(textPlaceholder.get(ERROR_MESSAGE), ""); assertEquals(textPlaceholder.get(CASE_FILE), String.format("folder%s_tc.js", File.separator)); assertEquals(textPlaceholder.get(CASE_LAST_URL), "http: assertEquals(textPlaceholder.get(CASE_START_URL), "http: assertEquals(textPlaceholder.get(STEP_INFORMATION), ""); assertEquals(textPlaceholder.get(TD_CSS_CLASS), "serviceOK"); assertEquals(textPlaceholder.get(SUITE_SUMMARY), ""); assertEquals(textPlaceholder.get(SUITE_FOLDER), ""); assertEquals(textPlaceholder.get(HOST), ""); assertEquals(textPlaceholder.get(BROWSER_INFO), ""); }
protected PlaceholderMap getTextPlaceholder(TestSuite testSuite) { PlaceholderMap placeholderMap = new PlaceholderMap(); OutputState outputState = OutputState.lookupSakuliState(testSuite.getState()); ScreenshotDiv screenshotDiv = screenshotDivConverter.convert(testSuite.getException()); placeholderMap.put(STATE, outputState.name()); placeholderMap.put(STATE_SHORT, outputState.getShortState()); placeholderMap.put(STATE_DESC, testSuite.getState().getNagiosStateDescription()); placeholderMap.put(SUITE_SUMMARY, generateStateSummary(testSuite.getState())); placeholderMap.put(NAME, testSuite.getName()); placeholderMap.put(ID, testSuite.getId()); placeholderMap.put(DURATION, String.format(Locale.ENGLISH, "%.2f", testSuite.getDuration())); placeholderMap.put(START_DATE, (testSuite.getStartDate() == null) ? "xx" : dateFormat.format(testSuite.getStartDate())); placeholderMap.put(STOP_DATE, (testSuite.getStopDate() == null) ? "xx" : dateFormat.format(testSuite.getStopDate())); placeholderMap.put(WARN_THRESHOLD, String.valueOf(testSuite.getWarningTime())); placeholderMap.put(CRITICAL_THRESHOLD, String.valueOf(testSuite.getCriticalTime())); placeholderMap.put(ERROR_SCREENSHOT, screenshotDiv != null ? screenshotDiv.getPayloadString() : null); placeholderMap.put(ERROR_MESSAGE, testSuite.getExceptionMessages(true)); placeholderMap.put(SUITE_FOLDER, testSuite.getTestSuiteFolder() != null ? testSuite.getTestSuiteFolder().toString() : null); placeholderMap.put(HOST, testSuite.getHost()); placeholderMap.put(BROWSER_INFO, testSuite.getBrowserInfo()); placeholderMap.put(TD_CSS_CLASS, "service" + outputState.name()); placeholderMap.put(CASE_INFORMATION, generateCaseInformation(testSuite.getTestCasesAsSortedSet())); placeholderMap.put(STEP_INFORMATION, testSuite.getTestCasesAsSortedSet().stream() .map(c -> generateStepInformation(c.getStepsAsSortedSet())) .collect(Collectors.joining())); return placeholderMap; }
AbstractOutputBuilder { protected PlaceholderMap getTextPlaceholder(TestSuite testSuite) { PlaceholderMap placeholderMap = new PlaceholderMap(); OutputState outputState = OutputState.lookupSakuliState(testSuite.getState()); ScreenshotDiv screenshotDiv = screenshotDivConverter.convert(testSuite.getException()); placeholderMap.put(STATE, outputState.name()); placeholderMap.put(STATE_SHORT, outputState.getShortState()); placeholderMap.put(STATE_DESC, testSuite.getState().getNagiosStateDescription()); placeholderMap.put(SUITE_SUMMARY, generateStateSummary(testSuite.getState())); placeholderMap.put(NAME, testSuite.getName()); placeholderMap.put(ID, testSuite.getId()); placeholderMap.put(DURATION, String.format(Locale.ENGLISH, "%.2f", testSuite.getDuration())); placeholderMap.put(START_DATE, (testSuite.getStartDate() == null) ? "xx" : dateFormat.format(testSuite.getStartDate())); placeholderMap.put(STOP_DATE, (testSuite.getStopDate() == null) ? "xx" : dateFormat.format(testSuite.getStopDate())); placeholderMap.put(WARN_THRESHOLD, String.valueOf(testSuite.getWarningTime())); placeholderMap.put(CRITICAL_THRESHOLD, String.valueOf(testSuite.getCriticalTime())); placeholderMap.put(ERROR_SCREENSHOT, screenshotDiv != null ? screenshotDiv.getPayloadString() : null); placeholderMap.put(ERROR_MESSAGE, testSuite.getExceptionMessages(true)); placeholderMap.put(SUITE_FOLDER, testSuite.getTestSuiteFolder() != null ? testSuite.getTestSuiteFolder().toString() : null); placeholderMap.put(HOST, testSuite.getHost()); placeholderMap.put(BROWSER_INFO, testSuite.getBrowserInfo()); placeholderMap.put(TD_CSS_CLASS, "service" + outputState.name()); placeholderMap.put(CASE_INFORMATION, generateCaseInformation(testSuite.getTestCasesAsSortedSet())); placeholderMap.put(STEP_INFORMATION, testSuite.getTestCasesAsSortedSet().stream() .map(c -> generateStepInformation(c.getStepsAsSortedSet())) .collect(Collectors.joining())); return placeholderMap; } }
AbstractOutputBuilder { protected PlaceholderMap getTextPlaceholder(TestSuite testSuite) { PlaceholderMap placeholderMap = new PlaceholderMap(); OutputState outputState = OutputState.lookupSakuliState(testSuite.getState()); ScreenshotDiv screenshotDiv = screenshotDivConverter.convert(testSuite.getException()); placeholderMap.put(STATE, outputState.name()); placeholderMap.put(STATE_SHORT, outputState.getShortState()); placeholderMap.put(STATE_DESC, testSuite.getState().getNagiosStateDescription()); placeholderMap.put(SUITE_SUMMARY, generateStateSummary(testSuite.getState())); placeholderMap.put(NAME, testSuite.getName()); placeholderMap.put(ID, testSuite.getId()); placeholderMap.put(DURATION, String.format(Locale.ENGLISH, "%.2f", testSuite.getDuration())); placeholderMap.put(START_DATE, (testSuite.getStartDate() == null) ? "xx" : dateFormat.format(testSuite.getStartDate())); placeholderMap.put(STOP_DATE, (testSuite.getStopDate() == null) ? "xx" : dateFormat.format(testSuite.getStopDate())); placeholderMap.put(WARN_THRESHOLD, String.valueOf(testSuite.getWarningTime())); placeholderMap.put(CRITICAL_THRESHOLD, String.valueOf(testSuite.getCriticalTime())); placeholderMap.put(ERROR_SCREENSHOT, screenshotDiv != null ? screenshotDiv.getPayloadString() : null); placeholderMap.put(ERROR_MESSAGE, testSuite.getExceptionMessages(true)); placeholderMap.put(SUITE_FOLDER, testSuite.getTestSuiteFolder() != null ? testSuite.getTestSuiteFolder().toString() : null); placeholderMap.put(HOST, testSuite.getHost()); placeholderMap.put(BROWSER_INFO, testSuite.getBrowserInfo()); placeholderMap.put(TD_CSS_CLASS, "service" + outputState.name()); placeholderMap.put(CASE_INFORMATION, generateCaseInformation(testSuite.getTestCasesAsSortedSet())); placeholderMap.put(STEP_INFORMATION, testSuite.getTestCasesAsSortedSet().stream() .map(c -> generateStepInformation(c.getStepsAsSortedSet())) .collect(Collectors.joining())); return placeholderMap; }  }
AbstractOutputBuilder { protected PlaceholderMap getTextPlaceholder(TestSuite testSuite) { PlaceholderMap placeholderMap = new PlaceholderMap(); OutputState outputState = OutputState.lookupSakuliState(testSuite.getState()); ScreenshotDiv screenshotDiv = screenshotDivConverter.convert(testSuite.getException()); placeholderMap.put(STATE, outputState.name()); placeholderMap.put(STATE_SHORT, outputState.getShortState()); placeholderMap.put(STATE_DESC, testSuite.getState().getNagiosStateDescription()); placeholderMap.put(SUITE_SUMMARY, generateStateSummary(testSuite.getState())); placeholderMap.put(NAME, testSuite.getName()); placeholderMap.put(ID, testSuite.getId()); placeholderMap.put(DURATION, String.format(Locale.ENGLISH, "%.2f", testSuite.getDuration())); placeholderMap.put(START_DATE, (testSuite.getStartDate() == null) ? "xx" : dateFormat.format(testSuite.getStartDate())); placeholderMap.put(STOP_DATE, (testSuite.getStopDate() == null) ? "xx" : dateFormat.format(testSuite.getStopDate())); placeholderMap.put(WARN_THRESHOLD, String.valueOf(testSuite.getWarningTime())); placeholderMap.put(CRITICAL_THRESHOLD, String.valueOf(testSuite.getCriticalTime())); placeholderMap.put(ERROR_SCREENSHOT, screenshotDiv != null ? screenshotDiv.getPayloadString() : null); placeholderMap.put(ERROR_MESSAGE, testSuite.getExceptionMessages(true)); placeholderMap.put(SUITE_FOLDER, testSuite.getTestSuiteFolder() != null ? testSuite.getTestSuiteFolder().toString() : null); placeholderMap.put(HOST, testSuite.getHost()); placeholderMap.put(BROWSER_INFO, testSuite.getBrowserInfo()); placeholderMap.put(TD_CSS_CLASS, "service" + outputState.name()); placeholderMap.put(CASE_INFORMATION, generateCaseInformation(testSuite.getTestCasesAsSortedSet())); placeholderMap.put(STEP_INFORMATION, testSuite.getTestCasesAsSortedSet().stream() .map(c -> generateStepInformation(c.getStepsAsSortedSet())) .collect(Collectors.joining())); return placeholderMap; }  static String replacePlaceHolder(String message, PlaceholderMap placeholderStringMap); }
AbstractOutputBuilder { protected PlaceholderMap getTextPlaceholder(TestSuite testSuite) { PlaceholderMap placeholderMap = new PlaceholderMap(); OutputState outputState = OutputState.lookupSakuliState(testSuite.getState()); ScreenshotDiv screenshotDiv = screenshotDivConverter.convert(testSuite.getException()); placeholderMap.put(STATE, outputState.name()); placeholderMap.put(STATE_SHORT, outputState.getShortState()); placeholderMap.put(STATE_DESC, testSuite.getState().getNagiosStateDescription()); placeholderMap.put(SUITE_SUMMARY, generateStateSummary(testSuite.getState())); placeholderMap.put(NAME, testSuite.getName()); placeholderMap.put(ID, testSuite.getId()); placeholderMap.put(DURATION, String.format(Locale.ENGLISH, "%.2f", testSuite.getDuration())); placeholderMap.put(START_DATE, (testSuite.getStartDate() == null) ? "xx" : dateFormat.format(testSuite.getStartDate())); placeholderMap.put(STOP_DATE, (testSuite.getStopDate() == null) ? "xx" : dateFormat.format(testSuite.getStopDate())); placeholderMap.put(WARN_THRESHOLD, String.valueOf(testSuite.getWarningTime())); placeholderMap.put(CRITICAL_THRESHOLD, String.valueOf(testSuite.getCriticalTime())); placeholderMap.put(ERROR_SCREENSHOT, screenshotDiv != null ? screenshotDiv.getPayloadString() : null); placeholderMap.put(ERROR_MESSAGE, testSuite.getExceptionMessages(true)); placeholderMap.put(SUITE_FOLDER, testSuite.getTestSuiteFolder() != null ? testSuite.getTestSuiteFolder().toString() : null); placeholderMap.put(HOST, testSuite.getHost()); placeholderMap.put(BROWSER_INFO, testSuite.getBrowserInfo()); placeholderMap.put(TD_CSS_CLASS, "service" + outputState.name()); placeholderMap.put(CASE_INFORMATION, generateCaseInformation(testSuite.getTestCasesAsSortedSet())); placeholderMap.put(STEP_INFORMATION, testSuite.getTestCasesAsSortedSet().stream() .map(c -> generateStepInformation(c.getStepsAsSortedSet())) .collect(Collectors.joining())); return placeholderMap; }  static String replacePlaceHolder(String message, PlaceholderMap placeholderStringMap); final static SimpleDateFormat dateFormat; }