diff --git a/pom.xml b/pom.xml index 522ac79c..6492850b 100644 --- a/pom.xml +++ b/pom.xml @@ -238,6 +238,13 @@ 2.3 test + + + xmlunit + xmlunit + 1.3 + test + diff --git a/src/test/java/org/springframework/hateoas/ResourceIntegrationTest.java b/src/test/java/org/springframework/hateoas/ResourceIntegrationTest.java index 71bf939e..d2874096 100644 --- a/src/test/java/org/springframework/hateoas/ResourceIntegrationTest.java +++ b/src/test/java/org/springframework/hateoas/ResourceIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * Copyright 2012-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.codehaus.jackson.annotate.JsonAutoDetect; import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility; +import org.custommonkey.xmlunit.Diff; import org.junit.Test; /** @@ -54,6 +55,7 @@ public class ResourceIntegrationTest extends AbstractMarshallingIntegrationTest /** * @see #124 + * @see #154 */ @Test public void marshalsResourceToXml() throws Exception { @@ -71,7 +73,7 @@ public class ResourceIntegrationTest extends AbstractMarshallingIntegrationTest Marshaller marshaller = context.createMarshaller(); marshaller.marshal(resource, writer); - assertThat(writer.toString(), is(XML_REFERENCE)); + assertThat(new Diff(XML_REFERENCE, writer.toString()).similar(), is(true)); } /** diff --git a/src/test/java/org/springframework/hateoas/VndErrorsMarshallingTest.java b/src/test/java/org/springframework/hateoas/VndErrorsMarshallingTest.java index 6eb77b04..10f97f7f 100644 --- a/src/test/java/org/springframework/hateoas/VndErrorsMarshallingTest.java +++ b/src/test/java/org/springframework/hateoas/VndErrorsMarshallingTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ import javax.xml.bind.Unmarshaller; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.SerializationConfig.Feature; +import org.custommonkey.xmlunit.Diff; import org.junit.Before; import org.junit.Test; import org.springframework.core.io.ClassPathResource; @@ -71,7 +72,6 @@ public class VndErrorsMarshallingTest { } @Before - @SuppressWarnings("deprecation") public void setUp() throws Exception { jackson1Mapper = new ObjectMapper(); @@ -92,26 +92,36 @@ public class VndErrorsMarshallingTest { errors = new VndErrors(error, error, error); } + /** + * @see #62 + */ @Test public void jackson1Marshalling() throws Exception { assertThat(jackson1Mapper.writeValueAsString(errors), is(jsonReference)); } + /** + * @see #62 + */ @Test public void jackson2Marshalling() throws Exception { assertThat(jackson2Mapper.writeValueAsString(errors), is(json2Reference)); } + /** + * @see #62, #154 + */ @Test public void jaxbMarshalling() throws Exception { Writer writer = new StringWriter(); marshaller.marshal(errors, writer); - assertThat(writer.toString(), is(xmlReference)); + + assertThat(new Diff(xmlReference, writer.toString()).similar(), is(true)); } /** - * @see #93, #94 + * @see #62, #93, #94 */ @Test public void jackson1UnMarshalling() throws Exception {