Polishing

This commit is contained in:
Juergen Hoeller
2014-07-02 17:32:43 +02:00
parent 07edf11e21
commit ede2150544
15 changed files with 76 additions and 90 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-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.
@@ -24,10 +24,7 @@ import java.util.List;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed;
import static org.custommonkey.xmlunit.XMLAssert.*;
import org.custommonkey.xmlunit.XMLUnit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.xml.sax.SAXException;
@@ -36,7 +33,13 @@ import org.springframework.http.MediaType;
import org.springframework.http.MockHttpInputMessage;
import org.springframework.http.MockHttpOutputMessage;
/** @author Arjen Poutsma */
import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* @author Arjen Poutsma
*/
public class AtomFeedHttpMessageConverterTests {
private AtomFeedHttpMessageConverter converter;
@@ -70,7 +73,7 @@ public class AtomFeedHttpMessageConverterTests {
Feed result = converter.read(Feed.class, inputMessage);
assertEquals("title", result.getTitle());
assertEquals("subtitle", result.getSubtitle().getValue());
List entries = result.getEntries();
List<?> entries = result.getEntries();
assertEquals(2, entries.size());
Entry entry1 = (Entry) entries.get(0);
@@ -95,7 +98,7 @@ public class AtomFeedHttpMessageConverterTests {
entry2.setId("id2");
entry2.setTitle("title2");
List entries = new ArrayList(2);
List<Entry> entries = new ArrayList<Entry>(2);
entries.add(entry1);
entries.add(entry2);
feed.setEntries(entries);
@@ -109,7 +112,6 @@ public class AtomFeedHttpMessageConverterTests {
"<entry><id>id1</id><title>title1</title></entry>" +
"<entry><id>id2</id><title>title2</title></entry></feed>";
assertXMLEqual(expected, outputMessage.getBodyAsString(utf8));
}
@Test
@@ -126,5 +128,4 @@ public class AtomFeedHttpMessageConverterTests {
outputMessage.getHeaders().getContentType());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-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.
@@ -24,10 +24,7 @@ import java.util.List;
import com.sun.syndication.feed.rss.Channel;
import com.sun.syndication.feed.rss.Item;
import static org.custommonkey.xmlunit.XMLAssert.*;
import org.custommonkey.xmlunit.XMLUnit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.xml.sax.SAXException;
@@ -36,7 +33,13 @@ import org.springframework.http.MediaType;
import org.springframework.http.MockHttpInputMessage;
import org.springframework.http.MockHttpOutputMessage;
/** @author Arjen Poutsma */
import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* @author Arjen Poutsma
*/
public class RssChannelHttpMessageConverterTests {
private RssChannelHttpMessageConverter converter;
@@ -72,7 +75,7 @@ public class RssChannelHttpMessageConverterTests {
assertEquals("http://example.com", result.getLink());
assertEquals("description", result.getDescription());
List items = result.getItems();
List<?> items = result.getItems();
assertEquals(2, items.size());
Item item1 = (Item) items.get(0);
@@ -95,7 +98,7 @@ public class RssChannelHttpMessageConverterTests {
Item item2 = new Item();
item2.setTitle("title2");
List items = new ArrayList(2);
List<Item> items = new ArrayList<Item>(2);
items.add(item1);
items.add(item2);
channel.setItems(items);
@@ -111,7 +114,6 @@ public class RssChannelHttpMessageConverterTests {
"<item><title>title2</title></item>" +
"</channel></rss>";
assertXMLEqual(expected, outputMessage.getBodyAsString(utf8));
}
@Test
@@ -134,5 +136,4 @@ public class RssChannelHttpMessageConverterTests {
outputMessage.getHeaders().getContentType());
}
}
}