|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2019 the original author or authors.
|
|
|
|
|
* Copyright 2012-2022 the original author or authors.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
@ -29,6 +29,7 @@ import com.google.gson.Gson;
|
|
|
|
|
import com.google.gson.GsonBuilder;
|
|
|
|
|
import com.google.gson.LongSerializationPolicy;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.skyscreamer.jsonassert.JSONAssert;
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
|
|
|
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
|
|
@ -150,7 +151,7 @@ class GsonAutoConfigurationTests {
|
|
|
|
|
void customGsonBuilder() {
|
|
|
|
|
this.contextRunner.withUserConfiguration(GsonBuilderConfig.class).run((context) -> {
|
|
|
|
|
Gson gson = context.getBean(Gson.class);
|
|
|
|
|
assertThat(gson.toJson(new DataObject())).isEqualTo("{\"data\":1,\"owner\":null}");
|
|
|
|
|
JSONAssert.assertEquals("{\"data\":1,\"owner\":null}", gson.toJson(new DataObject()), true);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|