@Test public void convertShouldThrowExceptionWhenJsonIsNull() throws Exception { assertThatThrownBy(() -> underTest.convert(PACKAGE_NAME, "NullTest", "null")) .isInstanceOf(IllegalArgumentException.class) .hasMessage("value must be an Object or Array"); }
@Nonnull @CheckReturnValue public String convert(@Nonnull String packageName, @Nonnull String className, @Nonnull String json) throws IOException { final JsonValue value = configuration.jsonParser().parse(json); final TypeSpec.Builder builder = fromValue(className, value).toBuilder(); for (final AnnotationPolicy policy : configuration.annotationPolicies()) { policy.apply(builder); } return configuration.javaBuilder().build(packageName, builder.build()); }
JavaConverter { @Nonnull @CheckReturnValue public String convert(@Nonnull String packageName, @Nonnull String className, @Nonnull String json) throws IOException { final JsonValue value = configuration.jsonParser().parse(json); final TypeSpec.Builder builder = fromValue(className, value).toBuilder(); for (final AnnotationPolicy policy : configuration.annotationPolicies()) { policy.apply(builder); } return configuration.javaBuilder().build(packageName, builder.build()); } }
JavaConverter { @Nonnull @CheckReturnValue public String convert(@Nonnull String packageName, @Nonnull String className, @Nonnull String json) throws IOException { final JsonValue value = configuration.jsonParser().parse(json); final TypeSpec.Builder builder = fromValue(className, value).toBuilder(); for (final AnnotationPolicy policy : configuration.annotationPolicies()) { policy.apply(builder); } return configuration.javaBuilder().build(packageName, builder.build()); } JavaConverter(@Nonnull Configuration configuration); }
JavaConverter { @Nonnull @CheckReturnValue public String convert(@Nonnull String packageName, @Nonnull String className, @Nonnull String json) throws IOException { final JsonValue value = configuration.jsonParser().parse(json); final TypeSpec.Builder builder = fromValue(className, value).toBuilder(); for (final AnnotationPolicy policy : configuration.annotationPolicies()) { policy.apply(builder); } return configuration.javaBuilder().build(packageName, builder.build()); } JavaConverter(@Nonnull Configuration configuration); @Nonnull @CheckReturnValue String convert(@Nonnull String packageName, @Nonnull String className, @Nonnull String json); }
JavaConverter { @Nonnull @CheckReturnValue public String convert(@Nonnull String packageName, @Nonnull String className, @Nonnull String json) throws IOException { final JsonValue value = configuration.jsonParser().parse(json); final TypeSpec.Builder builder = fromValue(className, value).toBuilder(); for (final AnnotationPolicy policy : configuration.annotationPolicies()) { policy.apply(builder); } return configuration.javaBuilder().build(packageName, builder.build()); } JavaConverter(@Nonnull Configuration configuration); @Nonnull @CheckReturnValue String convert(@Nonnull String packageName, @Nonnull String className, @Nonnull String json);  }