@Test public void checkPositiveValues() { SVGHelper.checkPositiveValues("vars", 1.0, 0.1); try { SVGHelper.checkPositiveValues("vars", 1.0, 0.1, -0.1); fail("Exception expected"); } catch (final IllegalArgumentException ex) { assertEquals("Values should be positive or zero and valid: {vars}=1.0, 0.1, -0.1", ex.getMessage()); } try { SVGHelper.checkPositiveValues("vars", 1.0, 0.1, Double.NaN); fail("Exception expected"); } catch (final IllegalArgumentException ex) { assertEquals("Values should be positive or zero and valid: {vars}=1.0, 0.1, NaN", ex.getMessage()); } try { SVGHelper.checkPositiveValues("vars", 1.0, 0.1, Double.POSITIVE_INFINITY); fail("Exception expected"); } catch (final IllegalArgumentException ex) { assertEquals("Values should be positive or zero and valid: {vars}=1.0, 0.1, Infinity", ex.getMessage()); } try { SVGHelper.checkPositiveValues("vars", Double.NEGATIVE_INFINITY); fail("Exception expected"); } catch (final IllegalArgumentException ex) { assertEquals("Values should be positive or zero and valid: {vars}=-Infinity", ex.getMessage()); } }
static void checkPositiveValues(final String varnames, final double... values) { for (final double value : values) { if (value <= 0 || Double.isNaN(value) || Double.isInfinite(value)) { throw new IllegalArgumentException("Values should be positive or zero and valid: {" + varnames + "}=" + StringHelper.doublesToString(", ", values)); } } }
SVGHelper { static void checkPositiveValues(final String varnames, final double... values) { for (final double value : values) { if (value <= 0 || Double.isNaN(value) || Double.isInfinite(value)) { throw new IllegalArgumentException("Values should be positive or zero and valid: {" + varnames + "}=" + StringHelper.doublesToString(", ", values)); } } } }
SVGHelper { static void checkPositiveValues(final String varnames, final double... values) { for (final double value : values) { if (value <= 0 || Double.isNaN(value) || Double.isInfinite(value)) { throw new IllegalArgumentException("Values should be positive or zero and valid: {" + varnames + "}=" + StringHelper.doublesToString(", ", values)); } } }  }
SVGHelper { static void checkPositiveValues(final String varnames, final double... values) { for (final double value : values) { if (value <= 0 || Double.isNaN(value) || Double.isInfinite(value)) { throw new IllegalArgumentException("Values should be positive or zero and valid: {" + varnames + "}=" + StringHelper.doublesToString(", ", values)); } } }  static Document createDocument(final double width, final double height); static void setAttribute(final Element element, final String attrName, final Object value); static String drawHorizontalConnectionLine(final GanttRelationType type, final double x1, final double y1, final double x2,
      final double y2, final double minXDist); static String drawArrow(final ArrowDirection direction, final double x, final double y, final double size); static Element createText(final Document document, final double x, final double y, final String text, final String... attributes); static Element createPath(final Document document, final String fill, final double strokeWidth, final String stroke,
      final String path, final String... attributes); static Element createPath(final Document document, final SVGColor fillColor, final double strokeWidth, final SVGColor strokeColor,
      final String path, final String... attributes); static Element createRect(final Document document, final double x, final double y, final double width, final double height,
      final String fill, final String... attributes); static Element createRect(final Document document, final double x, final double y, final double width, final double height,
      final SVGColor fillColor, final String... attributes); static Element createRect(final Document document, final double x, final double y, final double width, final double height,
      final SVGColor fillColor, final SVGColor strokeColor, final String... attributes); static Element createLine(final Document document, final double x1, final double y1, final double x2, final double y2,
      final SVGColor strokeColor, final String... attributes); static Element createLine(final Document document, final double x1, final double y1, final double x2, final double y2,
      final String... attributes); static Element createUse(final Document document, final String id, final double x, final double y, final String... attributes); static Element createElement(final Document document, final String tag, final SVGColor fillColor, final String... attributes); static Element createElement(final Document document, final String tag, final String... attributes); static String round(final double value); }
SVGHelper { static void checkPositiveValues(final String varnames, final double... values) { for (final double value : values) { if (value <= 0 || Double.isNaN(value) || Double.isInfinite(value)) { throw new IllegalArgumentException("Values should be positive or zero and valid: {" + varnames + "}=" + StringHelper.doublesToString(", ", values)); } } }  static Document createDocument(final double width, final double height); static void setAttribute(final Element element, final String attrName, final Object value); static String drawHorizontalConnectionLine(final GanttRelationType type, final double x1, final double y1, final double x2,
      final double y2, final double minXDist); static String drawArrow(final ArrowDirection direction, final double x, final double y, final double size); static Element createText(final Document document, final double x, final double y, final String text, final String... attributes); static Element createPath(final Document document, final String fill, final double strokeWidth, final String stroke,
      final String path, final String... attributes); static Element createPath(final Document document, final SVGColor fillColor, final double strokeWidth, final SVGColor strokeColor,
      final String path, final String... attributes); static Element createRect(final Document document, final double x, final double y, final double width, final double height,
      final String fill, final String... attributes); static Element createRect(final Document document, final double x, final double y, final double width, final double height,
      final SVGColor fillColor, final String... attributes); static Element createRect(final Document document, final double x, final double y, final double width, final double height,
      final SVGColor fillColor, final SVGColor strokeColor, final String... attributes); static Element createLine(final Document document, final double x1, final double y1, final double x2, final double y2,
      final SVGColor strokeColor, final String... attributes); static Element createLine(final Document document, final double x1, final double y1, final double x2, final double y2,
      final String... attributes); static Element createUse(final Document document, final String id, final double x, final double y, final String... attributes); static Element createElement(final Document document, final String tag, final SVGColor fillColor, final String... attributes); static Element createElement(final Document document, final String tag, final String... attributes); static String round(final double value);  }