#154 - Introduce XMLUnit to make sure we can build on Java 6 and 7.
Using XMLUnit's Diff to guard against minor changes in the default rendering of XML between Java 6 and 7.
This commit is contained in:
7
pom.xml
7
pom.xml
@@ -238,6 +238,13 @@
|
||||
<version>2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xmlunit</groupId>
|
||||
<artifactId>xmlunit</artifactId>
|
||||
<version>1.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user