Polish tests

This commit is contained in:
Rossen Stoyanchev
2015-06-30 12:10:01 -04:00
parent 38b8262e1e
commit c4e0f14ec4
3 changed files with 20 additions and 7 deletions

View File

@@ -43,6 +43,7 @@ import static org.junit.Assert.*;
* Test fixture for {@link Jaxb2CollectionHttpMessageConverter}.
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
*/
@SuppressWarnings("unused")
public class Jaxb2CollectionHttpMessageConverterTests {
@@ -151,9 +152,14 @@ public class Jaxb2CollectionHttpMessageConverterTests {
}
};
Collection<RootElement> result = converter.read(rootElementListType, null, inputMessage);
assertEquals(1, result.size());
assertEquals("", result.iterator().next().external);
try {
Collection<RootElement> result = converter.read(rootElementListType, null, inputMessage);
assertEquals(1, result.size());
assertEquals("", result.iterator().next().external);
}
catch (HttpMessageNotReadableException ex) {
// Some parsers raise an exception
}
}
@Test

View File

@@ -51,6 +51,7 @@ import static org.junit.Assert.assertTrue;
*
* @author Arjen Poutsma
* @author Sebastien Deleuze
* @author Rossen Stoyanchev
*/
@SuppressWarnings("unused")
public class Jaxb2RootElementHttpMessageConverterTests {

View File

@@ -21,6 +21,7 @@ import java.io.InputStreamReader;
import java.io.StringReader;
import java.nio.charset.Charset;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
@@ -49,13 +50,13 @@ import org.springframework.util.FileCopyUtils;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotEquals;
// Do NOT statically import org.junit.Assert.*, since XMLAssert extends junit.framework.Assert
/**
* @author Arjen Poutsma
* @author Rossen Stoyanchev
*/
public class SourceHttpMessageConverterTests {
@@ -226,8 +227,13 @@ public class SourceHttpMessageConverterTests {
streamReader.next();
String s = streamReader.getLocalName();
assertEquals("root", s);
s = streamReader.getElementText();
assertNotEquals("Foo Bar", s);
try {
s = streamReader.getElementText();
assertNotEquals("Foo Bar", s);
}
catch (XMLStreamException ex) {
// Some parsers raise a parse exception
}
streamReader.close();
}