@Test public void testNullSingleValueWithDefaultToIgnore() throws Throwable { Map<String, RequestProperty> props = collectContent(p("./param@DefaultValue", ":ignore")); assertEquals(1, props.size()); RequestProperty prop = props.get("/test/path/param"); assertFalse(prop.hasValues()); }
@Test public void testMultiValueWithAllBlanksIgnoringBlanks() throws Throwable { Map<String, RequestProperty> props = collectContent(p("./param", "", "", ""), p("./param@IgnoreBlanks", "true")); assertEquals(1, props.size()); RequestProperty prop = props.get("/test/path/param"); assertFalse(prop.hasValues()); }
@Test public void testSingleValueWithDefaultToNull() throws Throwable { Map<String, RequestProperty> props = collectContent(p("./param", ""), p("./param@DefaultValue", ":null")); assertEquals(1, props.size()); RequestProperty prop = props.get("/test/path/param"); assertTrue(prop.hasValues()); assertTrue(prop.providesValue()); assertNull(prop.getStringValues()); }
@Test public void testSingleValueWithBlank() throws Throwable { Map<String, RequestProperty> props = collectContent(p("./param", "")); assertEquals(1, props.size()); RequestProperty prop = props.get("/test/path/param"); assertTrue(prop.hasValues()); assertFalse(prop.providesValue()); assertEquals(1, prop.getStringValues().length); assertEquals("", prop.getStringValues()[0]); }
@Test public void testMultiValue() throws Throwable { Map<String, RequestProperty> props = collectContent(p("./param", "true", "false")); assertEquals(1, props.size()); RequestProperty prop = props.get("/test/path/param"); assertTrue(prop.hasValues()); assertTrue(prop.providesValue()); assertEquals(2, prop.getStringValues().length); assertEquals("true", prop.getStringValues()[0]); assertEquals("false", prop.getStringValues()[1]); }