@Test
  public void testAllFields() {

    String[] allFields = new String[] {"s", "i", "l", "d", "f", "s2"};
    ReflectionLuceneSerializer mapper1 = new ReflectionLuceneSerializer(Type1.class, allFields);
    ReflectionLuceneSerializer mapper2 = new ReflectionLuceneSerializer(Type2.class, allFields);

    Type1 type1 = new Type1("a", 1, 2L, 3.0, 4.0f);
    Type2 type2 = new Type2("a", 1, 2L, 3.0, 4.0f, "b");

    Document doc1 = invokeSerializer(mapper1, type1, allFields);

    assertEquals(5, doc1.getFields().size());
    assertEquals("a", doc1.getField("s").stringValue());
    assertEquals(1, doc1.getField("i").numericValue());
    assertEquals(2L, doc1.getField("l").numericValue());
    assertEquals(3.0, doc1.getField("d").numericValue());
    assertEquals(4.0f, doc1.getField("f").numericValue());

    Document doc2 = invokeSerializer(mapper2, type2, allFields);

    assertEquals(6, doc2.getFields().size());
    assertEquals("a", doc2.getField("s").stringValue());
    assertEquals("b", doc2.getField("s2").stringValue());
    assertEquals(1, doc2.getField("i").numericValue());
    assertEquals(2L, doc2.getField("l").numericValue());
    assertEquals(3.0, doc2.getField("d").numericValue());
    assertEquals(4.0f, doc2.getField("f").numericValue());
  }
Unit test of the ReflectionFieldMapperClass. Tests that all field types are mapped correctly.
geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/repository/serializer/ReflectionFieldMapperJUnitTest.java