Icon extends AbstractCssProperty<Icon> implements StateChangeInformer<Bean> { @Override public String getCssValue() { return cssValue; } Icon();  Icon(final String cssValue);  Icon(final Icon icon);  Icon(final String... imageUrls);  Icon(final UrlCss3Value... urlCss3Values); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override Icon setCssValue(final String cssValue); void setImageUrls(final String... imageUrls); void setImageUrls(final UrlCss3Value... urlCss3Values); List<UrlCss3Value> getUrlCss3Values(); void setAsInitial(); void setAsInherit(); @Override void stateChanged(final Bean stateChangedObject); static final String INITIAL; static final String INHERIT; static final String NONE; }
@Test public void testIconStringArray() { Icon icon = new Icon("/images/HelloDesign.jpg", "/images/HelloDesign2.jpg"); assertEquals("url(\"/images/HelloDesign.jpg\"), url(\"/images/HelloDesign2.jpg\")", icon.getCssValue()); }
@Test public void testIconUrlCss3ValueArray() { final UrlCss3Value urlCss3Value2 = new UrlCss3Value("url(\"/images/HelloDesign2.jpg\")"); final UrlCss3Value urlCss3Value1 = new UrlCss3Value("url(\"/images/HelloDesign.jpg\")"); Icon icon = new Icon(urlCss3Value1, urlCss3Value2); assertEquals("url(\"/images/HelloDesign.jpg\"), url(\"/images/HelloDesign2.jpg\")", icon.getCssValue()); }
@Test(expected = InvalidValueException.class) public void testIconUrlCss3ValueArrayInvalidValueAssignment1() { final UrlCss3Value urlCss3Value2 = new UrlCss3Value("url(\"/images/HelloDesign2.jpg\")"); final UrlCss3Value urlCss3Value1 = new UrlCss3Value("url(\"/images/HelloDesign.jpg\")"); Icon icon = new Icon(urlCss3Value1, urlCss3Value2); assertEquals("url(\"/images/HelloDesign.jpg\"), url(\"/images/HelloDesign2.jpg\")", icon.getCssValue()); try { urlCss3Value1.setX(50); } catch (InvalidValueException e) { assertEquals(-1, urlCss3Value1.getX()); assertEquals("url(\"/images/HelloDesign.jpg\")", urlCss3Value1.getValue()); throw e; } }
@Test(expected = InvalidValueException.class) public void testIconUrlCss3ValueArrayInvalidValueAssignment2() { final UrlCss3Value urlCss3Value2 = new UrlCss3Value("url(\"/images/HelloDesign2.jpg\")"); final UrlCss3Value urlCss3Value1 = new UrlCss3Value("url(\"/images/HelloDesign.jpg\")"); Icon icon = new Icon(urlCss3Value1, urlCss3Value2); assertEquals("url(\"/images/HelloDesign.jpg\"), url(\"/images/HelloDesign2.jpg\")", icon.getCssValue()); try { urlCss3Value1.setY(50); } catch (InvalidValueException e) { assertEquals(-1, urlCss3Value1.getY()); assertEquals("url(\"/images/HelloDesign.jpg\")", urlCss3Value1.getValue()); throw e; } }
@Test public void testGetCssValue() { Icon icon = new Icon(); icon.setCssValue("url(/images/HelloDesign.jpg), url(/images/HelloDesign2.jpg)"); assertEquals("url(\"/images/HelloDesign.jpg\"), url(\"/images/HelloDesign2.jpg\")", icon.getCssValue()); icon.setCssValue("url(\"/images/HelloDesign3.jpg\"), url(\"/images/HelloDesign4.jpg\")"); assertEquals("url(\"/images/HelloDesign3.jpg\"), url(\"/images/HelloDesign4.jpg\")", icon.getCssValue()); icon.setAsInherit(); assertNull(icon.getUrlCss3Values()); assertEquals(Icon.INHERIT, icon.getCssValue()); }
@Test public void testSetImageUrlsUrlCss3ValueArray() { final UrlCss3Value urlCss3Value2 = new UrlCss3Value("url(\"/images/HelloDesign2.jpg\")"); final UrlCss3Value urlCss3Value1 = new UrlCss3Value("url(\"/images/HelloDesign.jpg\")"); Icon icon = new Icon(urlCss3Value1, urlCss3Value2); assertEquals("url(\"/images/HelloDesign.jpg\"), url(\"/images/HelloDesign2.jpg\")", icon.getCssValue()); }
@Test(expected = InvalidValueException.class) public void testSetImageUrlsUrlCss3ValueArrayInvalidValueAssignment1() { final UrlCss3Value urlCss3Value2 = new UrlCss3Value("url(\"/images/HelloDesign2.jpg\")"); final UrlCss3Value urlCss3Value1 = new UrlCss3Value("url(\"/images/HelloDesign.jpg\")"); Icon icon = new Icon(urlCss3Value1, urlCss3Value2); assertEquals("url(\"/images/HelloDesign.jpg\"), url(\"/images/HelloDesign2.jpg\")", icon.getCssValue()); try { urlCss3Value1.setX(50); } catch (InvalidValueException e) { assertEquals(-1, urlCss3Value1.getX()); assertEquals("url(\"/images/HelloDesign.jpg\")", urlCss3Value1.getValue()); throw e; } }
@Test(expected = InvalidValueException.class) public void testSetImageUrlsUrlCss3ValueArrayInvalidValueAssignment2() { final UrlCss3Value urlCss3Value2 = new UrlCss3Value("url(\"/images/HelloDesign2.jpg\")"); final UrlCss3Value urlCss3Value1 = new UrlCss3Value("url(\"/images/HelloDesign.jpg\")"); Icon icon = new Icon(urlCss3Value1, urlCss3Value2); assertEquals("url(\"/images/HelloDesign.jpg\"), url(\"/images/HelloDesign2.jpg\")", icon.getCssValue()); try { urlCss3Value1.setX(50); } catch (InvalidValueException e) { assertEquals(-1, urlCss3Value1.getX()); assertEquals("url(\"/images/HelloDesign.jpg\")", urlCss3Value1.getValue()); throw e; } }