HtmlJavaInformationsReport extends HtmlAbstractReport { static String toBar(double percentValue) { final double myPercent = Math.max(Math.min(percentValue, 100d), 0d); final StringBuilder sb = new StringBuilder(); final String body = "<img src=''?resource=bar/rb_{0}.gif'' alt=''+'' title=''" + I18N.createPercentFormat().format(myPercent) + "%'' />"; final int fullBlockCount = (int) Math.floor(myPercent / (UNIT_SIZE * PARTIAL_BLOCKS)); final int partialBlockIndex = (int) Math .floor((myPercent - fullBlockCount * UNIT_SIZE * PARTIAL_BLOCKS) / UNIT_SIZE); sb.append(MessageFormat.format(body, fullBlockCount > 0 || partialBlockIndex > 0 ? "a" : "a0")); final String fullBody = MessageFormat.format(body, PARTIAL_BLOCKS); for (int i = 0; i < fullBlockCount; i++) { sb.append(fullBody); } if (partialBlockIndex > 0) { final String partialBody = MessageFormat.format(body, partialBlockIndex); sb.append(partialBody); } final int emptyBlocks = FULL_BLOCKS - fullBlockCount - (partialBlockIndex > 0 ? 1 : 0); final String emptyBody = MessageFormat.format(body, 0); for (int i = 0; i < emptyBlocks; i++) { sb.append(emptyBody); } sb.append(MessageFormat.format(body, fullBlockCount == FULL_BLOCKS ? "b" : "b0")); return sb.toString(); } HtmlJavaInformationsReport(List<JavaInformations> javaInformationsList, Writer writer); static String getOSIconName(String os); static String getApplicationServerIconName(String appServer);  }
@Test public void testToBar() { assertNotNull("toBar", HtmlJavaInformationsReport.toBar(0)); assertNotNull("toBar", HtmlJavaInformationsReport.toBar(1)); assertNotNull("toBar", HtmlJavaInformationsReport.toBar(10)); assertNotNull("toBar", HtmlJavaInformationsReport.toBar(15)); assertNotNull("toBarWithAlert", HtmlJavaInformationsReport.toBarWithAlert(10, "detail")); assertNotNull("toBarWithAlert", HtmlJavaInformationsReport.toBarWithAlert(100, "detail")); assertNotNull("toBarWithAlert", HtmlJavaInformationsReport.toBarWithAlert(100, null)); }