* @throws Exception
*/
public void testTo() throws Exception {
// CollectionResource<String> resource = new
// CollectionResource<String>();
CsvSerializer csvSerializer = new CsvSerializer() {
List<String[]> csvText =
new ArrayList<String[]>(
Arrays
.asList(new String[] {"Id",
"Name",
"Description",
"Assigned To",
"Severity", "Status"},
new String[] {
"2",
"Infinite Loop",
"\"When making target which depends on it self, the application freezes in an infinite loop\"",
"developer2",
"2-high", "New"},
new String[] {
"3",
"RSS feed component throws exception",
"When I open the policy manager home page" + lineSeparator
+ " (after I create business policy and perform some validations) I see the error.",
"developer3",
"4-minor", "New"},
new String[] {
"1",
"Localization problem",
"While running the application," + lineSeparator
+ "an exception that localization key is not found was thrown.",
"developer,1",
"2-high", "New"}));
public Iterator<String[]> getEntities() {
return csvText.iterator();
}
};
ByteArrayOutputStream os = new ByteArrayOutputStream();
MultivaluedMapImpl<String, Object> httpHeaders = new MultivaluedMapImpl<String, Object>();
new CsvSerializerProvider().writeTo(csvSerializer,
csvSerializer.getClass(),
null,
null,
MediaTypeUtils.CSV,
httpHeaders,
os);