### Question:
AnnotatedFieldDeserializer { public static void deserializeFormFields(Object target, ValueMap input) throws DeserializeException { List<Field> fields = FieldUtils.getFieldsListWithAnnotation(target.getClass(), FormField.class); deserializeFields(target, fields, input); } private  AnnotatedFieldDeserializer(); static void deserializeFormFields(Object target, ValueMap input); static void deserializeFields(Object target, List<Field> fields, ValueMap input); static Stream<AccessibleObject> getAllAnnotatedObjectMembers(Class source, Class<? extends Annotation> annotation); static Map<String, FieldComponent> getFormFields(Class source, SlingScriptHelper sling);  }### Answer:
@Test public void testPrimitiveInputs() throws Exception { final PrimitivesTest target = new PrimitivesTest(); Map<String, Object> params = new HashMap<>(); params.put("intValue", "123"); params.put("doubleValue", numberFormat.format(123.456)); params.put("floatValue", numberFormat.format(234.567f)); params.put("longValue", "1234567890"); params.put("booleanValue", "true"); AnnotatedFieldDeserializer.deserializeFormFields(target, new ModifiableValueMapDecorator(params)); assertEquals(123, target.intValue); assertEquals(123.456D, target.doubleValue, 0); assertEquals(234.567F, target.floatValue, 0); assertEquals(1234567890L, target.longValue); assertEquals(true, target.booleanValue); }
@Test public void testPrimitiveArrayInputs() throws Exception { final PrimitiveArrayTest target = new PrimitiveArrayTest(); Map<String, Object> params = new HashMap<>(); params.put("intValue", new String[]{"123", "456", "789"}); params.put("doubleValue", numberFormat.format(123.456)); params.put("floatValue", new String[]{ numberFormat.format(234.567f), numberFormat.format(111.222f), numberFormat.format(333.444f), numberFormat.format(555.666f)}); AnnotatedFieldDeserializer.deserializeFormFields(target, new ModifiableValueMapDecorator(params)); assertArrayEquals(new int[]{123, 456, 789}, target.intValue); assertArrayEquals(new double[]{123.456D}, target.doubleValue, 0); assertNotNull(target.floatValue); assertEquals(4, target.floatValue.size()); assertEquals(234.567F, target.floatValue.get(0), 0); assertEquals(111.222F, target.floatValue.get(1), 0); assertEquals(333.444F, target.floatValue.get(2), 0); assertEquals(555.666F, target.floatValue.get(3), 0); }
@Test public void testBooleanFalseByDefault() throws Exception { final PrimitivesTest target = new PrimitivesTest(); Map<String, Object> params = new HashMap<>(); params.put("intValue", "123"); params.put("doubleValue", numberFormat.format(123.456)); params.put("floatValue", numberFormat.format(234.567f)); params.put("longValue", "1234567890"); target.booleanValue = true; AnnotatedFieldDeserializer.deserializeFormFields(target, new ModifiableValueMapDecorator(params)); assertEquals(123, target.intValue); assertEquals(123.456D, target.doubleValue, 0); assertEquals(234.567F, target.floatValue, 0); assertEquals(1234567890L, target.longValue); assertEquals(false, target.booleanValue); }