### Question:
ResponseParser { public static String publicField(final Object obj, final Field field) throws IllegalAccessException { String parameterPair = null; try { parameterPair = URLEncoder.encode(CaseFormat.UPPER_CAMEL.to( CaseFormat.LOWER_UNDERSCORE, field.getName()), "UTF-8") + "=" + URLEncoder.encode(String.valueOf(field.get(obj)), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } assert parameterPair != null; return parameterPair.replace("+", "%20"); } private  ResponseParser(); static String toURLEncoded(final Class givenClass,
            final Object obj); static String publicField(final Object obj, final Field field); static String nonPublicField(final Class givenClass,
            final Object obj, final Field field); static void publicField(final String parameterName,
            final String parameterValue, final Class givenClass,
            final Object obj); static void nonPublicField(final String parameterName,
            final String parameterValue, final Class givenClass,
            final Object obj); static Object toObject(final String response,
            final Class givenClass); static String encodeParameter(final String parameterName,
            final String parameterValue);  }### Answer:
@Test public void testPublicField() throws IllegalAccessException, UnsupportedEncodingException, NoSuchFieldException { TestClass test = new TestClass(); Assert.assertNull(test.field1); ResponseParser.publicField("field1", "value", TestClass.class, test); Assert.assertEquals(test.field1, "value"); Field field = TestClass.class.getDeclaredField("field1"); String url = ResponseParser.publicField(test, field); Assert.assertEquals(url, "field1=value"); ResponseParser.publicField("field2", "true", TestClass.class, test); Assert.assertTrue(test.field2); }