@Test public void test_using_jsonbConfig() { String expectedJson = "\n" + "{\n" + " \"string\": null,\n" + " \"shortWrapper\": null,\n" + " \"shortPrimitive\": null,\n" + " \"longWrapper\": null,\n" + " \"longPrimitive\": null,\n" + " \"intWrapper\": null,\n" + " \"intPrimitive\": null,\n" + " \"floatWrapper\": null,\n" + " \"floatPrimitive\": null,\n" + " \"doubleWrapper\": null,\n" + " \"doublePrimitive\": null,\n" + " \"charWrapper\": null,\n" + " \"charPrimitive\": null,\n" + " \"byteWrapper\": null,\n" + " \"bytePrimitive\": null,\n" + " \"booleanWrapper\": null,\n" + " \"aBoolean\": null\n" + "}"; String actualJson = JsonbBuilder.create(RuntimeSampler.jsonbConfig()).toJson(new AllBasicTypes()); assertThat(actualJson).isEqualTo(expectedJson); }
public static JsonbConfig jsonbConfig() { return new JsonbConfig() .withNullValues(true) .withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() { @Override public boolean isVisible(Field field) { return false; } @Override public boolean isVisible(Method method) { return false; } }) .withPropertyNamingStrategy(PropertyNamingStrategy.CASE_INSENSITIVE) .withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE) .withAdapters(new ClassAdapter()) .withDeserializers(new CustomDeserializer()) .withSerializers(new CustomSerializer()) .withBinaryDataStrategy(BinaryDataStrategy.BASE_64_URL) .withDateFormat("MM/dd/yyyy", Locale.ENGLISH) .withLocale(Locale.CANADA) .withEncoding("UTF-8") .withStrictIJSON(true) .withFormatting(true); }
RuntimeSampler { public static JsonbConfig jsonbConfig() { return new JsonbConfig() .withNullValues(true) .withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() { @Override public boolean isVisible(Field field) { return false; } @Override public boolean isVisible(Method method) { return false; } }) .withPropertyNamingStrategy(PropertyNamingStrategy.CASE_INSENSITIVE) .withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE) .withAdapters(new ClassAdapter()) .withDeserializers(new CustomDeserializer()) .withSerializers(new CustomSerializer()) .withBinaryDataStrategy(BinaryDataStrategy.BASE_64_URL) .withDateFormat("MM/dd/yyyy", Locale.ENGLISH) .withLocale(Locale.CANADA) .withEncoding("UTF-8") .withStrictIJSON(true) .withFormatting(true); } }
RuntimeSampler { public static JsonbConfig jsonbConfig() { return new JsonbConfig() .withNullValues(true) .withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() { @Override public boolean isVisible(Field field) { return false; } @Override public boolean isVisible(Method method) { return false; } }) .withPropertyNamingStrategy(PropertyNamingStrategy.CASE_INSENSITIVE) .withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE) .withAdapters(new ClassAdapter()) .withDeserializers(new CustomDeserializer()) .withSerializers(new CustomSerializer()) .withBinaryDataStrategy(BinaryDataStrategy.BASE_64_URL) .withDateFormat("MM/dd/yyyy", Locale.ENGLISH) .withLocale(Locale.CANADA) .withEncoding("UTF-8") .withStrictIJSON(true) .withFormatting(true); }  }
RuntimeSampler { public static JsonbConfig jsonbConfig() { return new JsonbConfig() .withNullValues(true) .withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() { @Override public boolean isVisible(Field field) { return false; } @Override public boolean isVisible(Method method) { return false; } }) .withPropertyNamingStrategy(PropertyNamingStrategy.CASE_INSENSITIVE) .withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE) .withAdapters(new ClassAdapter()) .withDeserializers(new CustomDeserializer()) .withSerializers(new CustomSerializer()) .withBinaryDataStrategy(BinaryDataStrategy.BASE_64_URL) .withDateFormat("MM/dd/yyyy", Locale.ENGLISH) .withLocale(Locale.CANADA) .withEncoding("UTF-8") .withStrictIJSON(true) .withFormatting(true); }  static JsonbConfig jsonbConfig(); }
RuntimeSampler { public static JsonbConfig jsonbConfig() { return new JsonbConfig() .withNullValues(true) .withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() { @Override public boolean isVisible(Field field) { return false; } @Override public boolean isVisible(Method method) { return false; } }) .withPropertyNamingStrategy(PropertyNamingStrategy.CASE_INSENSITIVE) .withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE) .withAdapters(new ClassAdapter()) .withDeserializers(new CustomDeserializer()) .withSerializers(new CustomSerializer()) .withBinaryDataStrategy(BinaryDataStrategy.BASE_64_URL) .withDateFormat("MM/dd/yyyy", Locale.ENGLISH) .withLocale(Locale.CANADA) .withEncoding("UTF-8") .withStrictIJSON(true) .withFormatting(true); }  static JsonbConfig jsonbConfig();  }