@Override public String getAsText() { InternetAddress value = (InternetAddress) getValue(); return (value != null ? value.toUnicodeString() : ""); }
@Override public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) { try { setValue(new InternetAddress(text)); } catch (AddressException ex) { throw new IllegalArgumentException("Could not parse mail address: " + ex.getMessage()); } } else { setValue(null); } }
@Test(expected = IllegalArgumentException.class) public void simpleBadAddress() { editor.setAsText(BAD); }
@Test public void uninitialized() { assertEquals("Uninitialized editor did not return empty value string", EMPTY, editor.getAsText()); }
@Override public String getAsText() { InternetAddress value = (InternetAddress) getValue(); return (value != null ? value.toUnicodeString() : ""); }
@Override public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) { try { setValue(new InternetAddress(text)); } catch (AddressException ex) { throw new IllegalArgumentException("Could not parse mail address: " + ex.getMessage()); } } else { setValue(null); } }
@Override public String getAsText() { InternetAddress value = (InternetAddress) getValue(); return (value != null ? value.toUnicodeString() : ""); }
@Override public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) { try { setValue(new InternetAddress(text)); } catch (AddressException ex) { throw new IllegalArgumentException("Could not parse mail address: " + ex.getMessage()); } } else { setValue(null); } }