@Test public void testAbstractChangeEvent() throws Exception { String[] invalidPropertyNames = {null, "", " ", "\t", "\n"}; for (String invalidPropertyName : invalidPropertyNames) { try { new AbstractChangeEvent(null, invalidPropertyName, null, null) { @Override public String getDefaultDescription() { return null; } }; Assert.fail("AbstractChangeEvent must not allow the propertyName to be " + invalidPropertyName + "!"); } catch (IllegalArgumentException ignored) { } } AbstractChangeEvent ace = new AbstractChangeEvent(null, "label", null, null) { @Override public String getDefaultDescription() { return "ACE"; } }; Assert.assertEquals("label", ace.getPropertyName()); Assert.assertEquals(null, ace.getBefore()); Assert.assertEquals(null, ace.getAfter()); Assert.assertEquals("ACE", ace.getDefaultDescription()); AbstractChangeEvent aceComplete = new AbstractChangeEvent(null, "label", "gren", "green") { @Override public String getDefaultDescription() { return "ACE"; } }; testValidSystemEvent(aceComplete, "label", "gren", "green"); }
public AbstractChangeEvent(UserInfo user, String propertyName, String before, String after) { super(user); if (StringUtils.isBlank(propertyName)) { throw new IllegalArgumentException("PropertyName must not be blank or null."); } this.propertyName = propertyName; this.before = before; this.after = after; }
AbstractChangeEvent extends AbstractEvent implements ChangeEvent { public AbstractChangeEvent(UserInfo user, String propertyName, String before, String after) { super(user); if (StringUtils.isBlank(propertyName)) { throw new IllegalArgumentException("PropertyName must not be blank or null."); } this.propertyName = propertyName; this.before = before; this.after = after; } }
AbstractChangeEvent extends AbstractEvent implements ChangeEvent { public AbstractChangeEvent(UserInfo user, String propertyName, String before, String after) { super(user); if (StringUtils.isBlank(propertyName)) { throw new IllegalArgumentException("PropertyName must not be blank or null."); } this.propertyName = propertyName; this.before = before; this.after = after; } AbstractChangeEvent(UserInfo user, String propertyName, String before, String after); }
AbstractChangeEvent extends AbstractEvent implements ChangeEvent { public AbstractChangeEvent(UserInfo user, String propertyName, String before, String after) { super(user); if (StringUtils.isBlank(propertyName)) { throw new IllegalArgumentException("PropertyName must not be blank or null."); } this.propertyName = propertyName; this.before = before; this.after = after; } AbstractChangeEvent(UserInfo user, String propertyName, String before, String after); @Override String getPropertyName(); @Override String getBefore(); @Override String getAfter(); }
AbstractChangeEvent extends AbstractEvent implements ChangeEvent { public AbstractChangeEvent(UserInfo user, String propertyName, String before, String after) { super(user); if (StringUtils.isBlank(propertyName)) { throw new IllegalArgumentException("PropertyName must not be blank or null."); } this.propertyName = propertyName; this.before = before; this.after = after; } AbstractChangeEvent(UserInfo user, String propertyName, String before, String after); @Override String getPropertyName(); @Override String getBefore(); @Override String getAfter();  }