StringProducer extends BaseTypeProducer { @Override protected Object createValue(String value) throws Exception { return value; }    }
@Test public void createsInstanceAndUsesSingleValueFromMap() throws Exception { MultivaluedMap<String, String> values = new MultivaluedMapImpl(); values.putSingle("foo", "bar"); Object result = producer.createValue("foo", values, null); assertEquals("bar", result); }
@Test public void createsInstanceAndUsesFirstValueFromMap() throws Exception { MultivaluedMap<String, String> values = new MultivaluedMapImpl(); values.addAll("foo", "bar", "baz"); Object result = producer.createValue("foo", values, null); assertEquals("bar", result); }
@Test public void createsInstanceAndUsesDefault() throws Exception { MultivaluedMap<String, String> values = new MultivaluedMapImpl(); Object result = producer.createValue("foo", values, "baz"); assertEquals("baz", result); }
@Test public void returnsNullWhenMapDoesNotContainRequiredValueAndDefaultValueIsNull() throws Exception { MultivaluedMap<String, String> values = new MultivaluedMapImpl(); Object result = producer.createValue("foo", values, null); assertNull(result); }