Skip to content

Commit

Permalink
Merge branch '2.18'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 27, 2024
2 parents f0fd4b7 + a359144 commit 20204ed
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 38 deletions.
2 changes: 0 additions & 2 deletions src/test/java/tools/jackson/core/JDKSerializabilityTest.java
Expand Up @@ -12,8 +12,6 @@
import tools.jackson.core.util.JsonRecyclerPools;
import tools.jackson.core.util.RecyclerPool;

import static com.fasterxml.jackson.core.util.JdkSerializationTestUtils.jdkDeserialize;
import static com.fasterxml.jackson.core.util.JdkSerializationTestUtils.jdkSerialize;
import static org.junit.jupiter.api.Assertions.*;

/**
Expand Down
30 changes: 30 additions & 0 deletions src/test/java/tools/jackson/core/JUnit5TestBase.java
Expand Up @@ -415,6 +415,12 @@ protected int[] calcQuads(byte[] wordBytes) {
return result;
}

/*
/**********************************************************************
/* Content reading, serialization
/**********************************************************************
*/

public static byte[] readResource(String ref)
{
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
Expand All @@ -437,4 +443,28 @@ public static byte[] readResource(String ref)
}
return bytes.toByteArray();
}

public static byte[] jdkSerialize(Object o) throws IOException
{
ByteArrayOutputStream bytes = new ByteArrayOutputStream(1000);
ObjectOutputStream obOut = new ObjectOutputStream(bytes);
obOut.writeObject(o);
obOut.close();
return bytes.toByteArray();
}

@SuppressWarnings("unchecked")
public static <T> T jdkDeserialize(byte[] raw) throws IOException
{
ObjectInputStream objIn = new ObjectInputStream(new ByteArrayInputStream(raw));
try {
return (T) objIn.readObject();
} catch (ClassNotFoundException e) {
fail("Missing class: "+e.getMessage());
return null;
} finally {
objIn.close();
}
}

}

This file was deleted.

Expand Up @@ -10,8 +10,6 @@
import tools.jackson.core.io.SerializedString;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static tools.jackson.core.util.JdkSerializationTestUtils.jdkDeserialize;
import static tools.jackson.core.util.JdkSerializationTestUtils.jdkSerialize;

/**
* Simple unit tests to try to verify that the default
Expand Down

0 comments on commit 20204ed

Please sign in to comment.