Graylog2 / Graylog2/graylog2-server

Test can fail if serialization result is in a different order

Open
#7,445 0 comments 0 reactions 0 assignees View on GitHub
bug triaged
Dominant language
Java
Stars
8.1k
Forks
1.1k
Avg merge
1d 20h
Merged PRs (30d)
217

Description

Similar to #6907 (The test method uses `jackson` to serialize objects into JSON and assert the serialized results with JSON string. However, the order of serialized JSON is not guaranteed), test `shouldDeserializeSerializedContentPack` in `org.graylog2.contentpacks.model.ContentPackTest` has the same problem.

## Expected Behavior

Tests should always pass if no changes made to the code

## Current Behavior

Tests may fail or pass with no changes made to the source code.

## Possible Solution

A more sophisticated comparison should be used. For example, using a library like https://github.com/skyscreamer/JSONassert

## Context

According to the specification, `An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.