Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed May 27, 2024
1 parent c492b75 commit 4650f0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static <O> void assertDecodes(DynamicOps<JsonElement> jsonOps, String jso
public static <O, T> void assertDecodes(DynamicOps<T> ops, T data, O expected, Codec<O> codec) {
DataResult<O> dataResult = codec.parse(ops, data);
Assertions.assertTrue(dataResult.result().isPresent());
Assertions.assertEquals(dataResult.result().get(), expected);
Assertions.assertEquals(expected, dataResult.result().get());
}

public static <O> void assertEncodes(DynamicOps<JsonElement> jsonOps, O value, String json, Codec<O> codec) {
Expand All @@ -32,7 +32,7 @@ public static <O> void assertEncodes(DynamicOps<JsonElement> jsonOps, O value, S
public static <O, T> void assertEncodes(DynamicOps<T> ops, O value, T expected, Codec<O> codec) {
DataResult<T> dataResult = codec.encodeStart(ops, value);
Assertions.assertTrue(dataResult.result().isPresent());
Assertions.assertEquals(dataResult.result().get(), expected);
Assertions.assertEquals(expected, dataResult.result().get());
}

public static void assertJsonEquals(String expected, String actual) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,15 @@ public int hashCode() {
}

private final String both = """
[
{
"index": 0,
"value": "Hello"
},
{
"index": 1,
"value": 42
}
]""";
{
"string": "Hello",
"integer": 42
}""";

private final String onlyChanged = """
[
{
"index": 1,
"value": 42
}
]""";
{
"integer": 42
}""";

@Test
void testEncodeMutable() {
Expand Down

0 comments on commit 4650f0f

Please sign in to comment.