@Test
  @SuppressWarnings("rawtypes")
  public void wordDelimitersCausesCamelCase()
      throws ClassNotFoundException, IntrospectionException, InstantiationException,
          IllegalAccessException, InvocationTargetException {

    ClassLoader resultsClassLoader =
        generateAndCompile(
            "/schema/properties/propertiesWithWordDelimiters.json",
            "com.example",
            config("usePrimitives", true, "propertyWordDelimiters", "_ -"));

    Class generatedType = resultsClassLoader.loadClass("com.example.WordDelimit");

    Object instance = generatedType.newInstance();

    new PropertyDescriptor("propertyWithUnderscores", generatedType)
        .getWriteMethod()
        .invoke(instance, "a_b_c");
    new PropertyDescriptor("propertyWithHyphens", generatedType)
        .getWriteMethod()
        .invoke(instance, "a-b-c");
    new PropertyDescriptor("propertyWithMixedDelimiters", generatedType)
        .getWriteMethod()
        .invoke(instance, "a b_c-d");

    JsonNode jsonified = mapper.valueToTree(instance);

    assertThat(jsonified.has("property_with_underscores"), is(true));
    assertThat(jsonified.has("property-with-hyphens"), is(true));
    assertThat(jsonified.has("property_with mixed-delimiters"), is(true));
  }
 private List<Ex1> getList(Class<? extends FileExporterDescription> exporter) {
   try {
     FileExporterDescription instance = exporter.newInstance();
     return tester.getList(
         Ex1.class,
         Location.fromPath(instance.getPathPrefix(), '/'),
         new Comparator<Ex1>() {
           @Override
           public int compare(Ex1 o1, Ex1 o2) {
             return o1.getSidOption().compareTo(o2.getSidOption());
           }
         });
   } catch (Exception e) {
     throw new AssertionError(e);
   }
 }
  @Test
  @SuppressWarnings("rawtypes")
  public void propertiesWithNullValuesAreOmittedWhenSerialized()
      throws ClassNotFoundException, IntrospectionException, InstantiationException,
          IllegalAccessException, InvocationTargetException {

    ClassLoader resultsClassLoader =
        generateAndCompile("/schema/properties/nullProperties.json", "com.example");

    Class generatedType = resultsClassLoader.loadClass("com.example.NullProperties");
    Object instance = generatedType.newInstance();

    Method setter = new PropertyDescriptor("property", generatedType).getWriteMethod();
    setter.invoke(instance, "value");

    assertThat(mapper.valueToTree(instance).toString(), containsString("property"));

    setter.invoke(instance, (Object) null);

    assertThat(mapper.valueToTree(instance).toString(), not(containsString("property")));
  }
  @Test
  @SuppressWarnings("rawtypes")
  public void propertiesAreSerializedInCorrectOrder()
      throws ClassNotFoundException, IntrospectionException, InstantiationException,
          IllegalAccessException, InvocationTargetException {

    ClassLoader resultsClassLoader =
        generateAndCompile("/schema/properties/orderedProperties.json", "com.example");

    Class generatedType = resultsClassLoader.loadClass("com.example.OrderedProperties");
    Object instance = generatedType.newInstance();

    new PropertyDescriptor("type", generatedType).getWriteMethod().invoke(instance, "1");
    new PropertyDescriptor("id", generatedType).getWriteMethod().invoke(instance, "2");
    new PropertyDescriptor("name", generatedType).getWriteMethod().invoke(instance, "3");
    new PropertyDescriptor("hastickets", generatedType).getWriteMethod().invoke(instance, true);
    new PropertyDescriptor("starttime", generatedType).getWriteMethod().invoke(instance, "4");

    String serialized = mapper.valueToTree(instance).toString();

    assertThat(
        "Properties are not in expected order",
        serialized.indexOf("type"),
        is(lessThan(serialized.indexOf("id"))));
    assertThat(
        "Properties are not in expected order",
        serialized.indexOf("id"),
        is(lessThan(serialized.indexOf("name"))));
    assertThat(
        "Properties are not in expected order",
        serialized.indexOf("name"),
        is(lessThan(serialized.indexOf("hastickets"))));
    assertThat(
        "Properties are not in expected order",
        serialized.indexOf("hastickets"),
        is(lessThan(serialized.indexOf("starttime"))));
  }