Skip to content

Commit

Permalink
chore: No need for pretty printing when constructing example payloads…
Browse files Browse the repository at this point in the history
… for ExampleFuzzer
  • Loading branch information
en-milie committed Sep 23, 2024
1 parent bcbb7e3 commit d50c8c7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/com/endava/cats/util/JsonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ public abstract class JsonUtils {
private static final Pattern JSON_SQUARE_BR_KEYS = Pattern.compile("\\w+(\\[(?>[a-zA-Z0-9_*]*[a-zA-Z][a-zA-Z0-9_*]*)])+\\w*");
private static final Pattern EMPTY_SQUARE_BRACKETS = Pattern.compile("\\w+\\[]\\w*");


/**
* To not be used to serialize data ending in console of files. Use the TestCaseExporter serializer for that.
* To not be used to serialize data ending in console or files. Use the TestCaseExporter serializer for that.
*/
public static final Gson GSON = new GsonBuilder()
.setStrictness(Strictness.LENIENT)
Expand All @@ -90,6 +91,15 @@ public abstract class JsonUtils {
.serializeNulls()
.create();

public static final Gson GSON_NO_PRETTY_PRINTING = new GsonBuilder()
.setStrictness(Strictness.LENIENT)
.disableHtmlEscaping()
.setExclusionStrategies(new ExcludeTestCaseStrategy())
.registerTypeAdapter(Long.class, new LongTypeSerializer())
.registerTypeAdapter(OffsetDateTime.class, new OffsetDatetimeTypeAdapter())
.serializeNulls()
.create();

public static final Configuration SUPPRESS_EXCEPTIONS_CONFIGURATION = new Configuration.ConfigurationBuilder().options(Option.SUPPRESS_EXCEPTIONS).build();

public static final Configuration GSON_CONFIGURATION = Configuration.builder().jsonProvider(new GsonJsonProvider(GSON)).mappingProvider(new GsonMappingProvider(GSON)).build();
Expand Down

0 comments on commit d50c8c7

Please sign in to comment.