/** Test */ @Test public void testNewValue1Prepend() { AttributeModifier prepender = AttributeModifier.prepend("attr", null); assertEquals("newvalue oldvalue", prepender.newValue("oldvalue", "newvalue")); assertEquals("newvalue", prepender.newValue("", "newvalue")); assertEquals("newvalue", prepender.newValue(null, "newvalue")); assertEquals("oldvalue", prepender.newValue("oldvalue", "")); assertEquals("oldvalue", prepender.newValue("oldvalue", null)); assertNull(prepender.newValue(null, null)); }
/** Test */ @Test public void testNewValue2Prepend() { AttributeModifier appender = AttributeModifier.prepend("attr", null).setSeparator(";"); assertEquals("newvalue;oldvalue", appender.newValue("oldvalue", "newvalue")); assertEquals("newvalue", appender.newValue("", "newvalue")); assertEquals("newvalue", appender.newValue(null, "newvalue")); assertEquals("oldvalue", appender.newValue("oldvalue", "")); assertEquals("oldvalue", appender.newValue("oldvalue", null)); assertNull(appender.newValue(null, null)); }
/** Test */ @Test public void testNewValue1Append() { AttributeModifier appender = AttributeModifier.append("attr", null); assertEquals("oldvalue newvalue", appender.newValue("oldvalue", "newvalue")); assertEquals("newvalue", appender.newValue("", "newvalue")); assertEquals("newvalue", appender.newValue(null, "newvalue")); assertEquals("oldvalue", appender.newValue("oldvalue", "")); assertEquals("oldvalue", appender.newValue("oldvalue", null)); assertNull(appender.newValue(null, null)); }