### Question:
Parameter { public static final Parameter newParameter(final int id, final String item, final String type, final String config) { Parameter p = null; if (BODY_ITEM.equals(item)) { if (STRING_TYPE.equals(type)) { p = new StringBodyParameter(id); } else if (BYTEARRAY_TYPE.equals(type)) { p = new ByteArrayBodyParameter(id); } } else if ((item != null) && item.startsWith(HEADER_ITEM_PREFIX)) { final String header = item.substring(HEADER_ITEM_PREFIX.length()); if (STRING_TYPE.equals(type)) { p = new StringHeaderParameter(id, header); } else if (LONG_TYPE.equals(type)) { p = new LongHeaderParameter(id, header); } else if (INT_TYPE.equals(type)) { p = new IntHeaderParameter(id, header); } else if (DATE_TYPE.equals(type)) { p = new DateHeaderParameter(id, header); } else if (DOUBLE_TYPE.equals(type)) { p = new DoubleHeaderParameter(id, header); } else if (FLOAT_TYPE.equals(type)) { p = new FloatHeaderParameter(id, header); } } else if (CUSTOM_ITEM.equals(item)) { try { p = (CustomParameter) Class.forName(type).getConstructor(Integer.TYPE) .newInstance(new Object[] { id }); } catch (Exception e) { throw new IllegalArgumentException( "Could not initialize custom parameter type: " + type + " with config: " + config + "."); } } if (p != null) { p.configure(config); return p; } throw new IllegalArgumentException("Invalid SQL parameter item: " + item + " and type: " + type + " with config: " + config + "."); } protected  Parameter(final int id); static final Parameter newParameter(final int id, final String item,
      final String type, final String config); abstract void setValue(final PreparedStatement ps, final Event e); void configure(final String config);  }### Answer:
@Test public void testStringBodyParameterNoParameter() throws Exception { Parameter.newParameter(1, "body", "string", null); }
@Test public void testStringBodyParameterBlankParameter() throws Exception { Parameter.newParameter(1, "body", "string", ""); }
@Test public void testIntHeaderParameter() throws Exception { final Parameter p = Parameter.newParameter(1, "header.foo", "int", null); assertThat(p, notNullValue()); }
@Test public void testDateHeaderNoTimeZone() throws Exception { Parameter.newParameter(1, "header.foo", "date", "yyyy-MM-dd HH:mm:ss"); }
@Test(expected = IllegalArgumentException.class) public void testInvalidItem() throws Exception { Parameter.newParameter(1, "foo", "long", null); }
@Test(expected = IllegalArgumentException.class) public void testInvalidType() throws Exception { Parameter.newParameter(1, "body", "foo", null); }
@Test public void testCustomParameterCreation() throws Exception { final Parameter p = Parameter .newParameter(1, "custom", "org.apache.flume.sink.jdbc.TestParameter$TestCustomParameter", "UTF-8"); assertThat(p, notNullValue()); assertTrue(p instanceof TestCustomParameter); }