提交 c4e0f14e 编写于 作者: R Rossen Stoyanchev

Polish tests

上级 38b8262e
......@@ -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
......
......@@ -51,6 +51,7 @@ import static org.junit.Assert.assertTrue;
*
* @author Arjen Poutsma
* @author Sebastien Deleuze
* @author Rossen Stoyanchev
*/
@SuppressWarnings("unused")
public class Jaxb2RootElementHttpMessageConverterTests {
......
......@@ -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();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册