Refactor to add XML test. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/c7be2fe0 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c7be2fe0 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c7be2fe0
Branch: refs/heads/LOG4J2-1356 Commit: c7be2fe0110da46108b518edda51b5fa358cecb2 Parents: 57b72ed Author: ggregory <[email protected]> Authored: Wed Apr 6 14:28:03 2016 -0700 Committer: ggregory <[email protected]> Committed: Wed Apr 6 14:28:03 2016 -0700 ---------------------------------------------------------------------- .../logging/log4j/core/impl/ThrowableProxyTest.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c7be2fe0/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/ThrowableProxyTest.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/ThrowableProxyTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/ThrowableProxyTest.java index ef3373c..f1ec4b9 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/ThrowableProxyTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/ThrowableProxyTest.java @@ -36,6 +36,7 @@ import javax.xml.bind.DatatypeConverter; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.jackson.Log4jJsonObjectMapper; +import org.apache.logging.log4j.core.jackson.Log4jXmlObjectMapper; import org.junit.Test; import com.fasterxml.jackson.annotation.JsonProperty; @@ -72,9 +73,7 @@ public class ThrowableProxyTest { return arr.toByteArray(); } - @Test - public void testJsonIoContainer() throws IOException { - final ObjectMapper objectMapper = new Log4jJsonObjectMapper(); + private void testIoContainer(ObjectMapper objectMapper ) throws IOException { final Fixture expected = new Fixture(); final String s = objectMapper.writeValueAsString(expected); final Fixture actual = objectMapper.readValue(s, Fixture.class); @@ -86,6 +85,16 @@ public class ThrowableProxyTest { assertEquals(expected.proxy, actual.proxy); } + @Test + public void testIoContainerAsJson() throws IOException { + testIoContainer(new Log4jJsonObjectMapper()); + } + + @Test + public void testIoContainerAsXml() throws IOException { + testIoContainer(new Log4jXmlObjectMapper()); + } + /** * Attempts to instantiate a class that cannot initialize and then logs the stack trace of the Error. The logger * must not fail when using {@link ThrowableProxy} to inspect the frames of the stack trace.
