Skip to content

Implement equals for the ImmutableMetadata object #511

Closed
@thomaspoignant

Description

@thomaspoignant

Context

When working with an ImmutableMetadata it is hard to write tests because we cannot compare a FlagEvaluationDetails anymore.

String flagKey = "bool_targeting_match";
FlagEvaluationDetails expected = FlagEvaluationDetails.builder()
        .reason(Reason.ERROR.toString())
        .value(false)
        .errorCode(ErrorCode.GENERAL)
        .errorMessage("impossible to contact GO Feature Flag relay proxy instance")
        .flagMetadata(ImmutableMetadata.builder().build())
        .build();
FlagEvaluationDetails<Boolean> got = goffClient.getBooleanDetails(flagKey, false, defaultEvaluationContext);
assertEquals(expected, got);

The JUNIT method assertEquals is comparing the reference of the object.

Expected behavior

We should be able to use assertEquals for the whole FlagEvaluationDetails object.
For this we should probably implement the equals() method in the ImmutableMetadata object.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions