From 00ab9f38e08643acda3b560e01236ced0d77d5c2 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 16 Sep 2019 11:38:20 -0400 Subject: Eliminate constructors with side-effects Several of the Gson and Jackson handlers take a GsonBuilder, which they then configure with additional adapters prior to create a Gson object that they subsequently use. The code has been modified so that the constructors no longer take a GsonBuilder, thus eliminating the side-effects that they had on the builders. Instead, a configBuilder() method has been added to the handler classes that makes it clear tht they modify the GsonBuilder. This also has the advantage that classes that want a Gson object configured per a given handler need only call that handler's configBuilder() method; previously, they had to constructor the handler and then retrieve its gson object. Also updated a few tests to specify the HTTP "Accept" header to ensure that return results are in yaml format. Change-Id: I2ef98198041ff9f73913d01ee6ee14ecf20ba617 Issue-ID: POLICY-2081 Signed-off-by: Jim Hahn --- .../java/org/onap/policy/common/utils/gson/GsonTestUtilsBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils-test') diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/gson/GsonTestUtilsBuilder.java b/utils-test/src/main/java/org/onap/policy/common/utils/gson/GsonTestUtilsBuilder.java index 1f697fdb..dcf27750 100644 --- a/utils-test/src/main/java/org/onap/policy/common/utils/gson/GsonTestUtilsBuilder.java +++ b/utils-test/src/main/java/org/onap/policy/common/utils/gson/GsonTestUtilsBuilder.java @@ -37,7 +37,7 @@ public class GsonTestUtilsBuilder { gsonBldr = new GsonBuilder(); // register jackson behaviors with the builder - new JacksonHandler(gsonBldr); + JacksonHandler.configBuilder(gsonBldr); } /** -- cgit 1.2.3-korg