package utils;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;

import org.junit.Test;

import junit.framework.Assert;

public class CollectionToListConverterTest {

	private static final String DUMMY_VALUE = "DUMMY_VALUE";

	@Test(expected = NullPointerException.class)
	public void testNull() throws Exception {
		new CollectionToListConverter<String>(null).convert();
	}

	@Test
	public void testEmpty() throws Exception {
		List<String> list = new CollectionToListConverter<String>(Collections.emptyList()).convert();

		Assert.assertEquals(0, list.size());
	}

	@Test
	public void testOneElement() throws Exception {
		Collection<String> collection = new HashSet<>();
		collection.add(DUMMY_VALUE);
		List<String> list = new CollectionToListConverter<String>(collection).convert();

		Assert.assertEquals(1, list.size());
		Assert.assertEquals(DUMMY_VALUE, list.get(0));
	}

}

@@ -9,16 +9,44 @@
 utils;%0A%0A
+import java.util.ArrayList;%0A
 import j
@@ -521,33 +521,37 @@
 t%3CString%3E list =
- 
+%0A%09%09%09%09
 new CollectionTo
@@ -680,18 +680,28 @@
 test
-OneElement
+CollectionConversion
 () t
@@ -968,18 +968,414 @@
 st.get(0));%0A
+%09%09Assert.assertTrue(list != collection);%0A%09%7D%0A%0A%09@Test%0A%09public void testListConversion() throws Exception %7B%0A%09%09List%3CString%3E collection = new ArrayList%3C%3E();%0A%09%09collection.add(DUMMY_VALUE);%0A%09%09List%3CString%3E list = new CollectionToListConverter%3CString%3E(collection).convert();%0A%0A%09%09Assert.assertEquals(1, list.size());%0A%09%09Assert.assertEquals(DUMMY_VALUE, list.get(0));%0A%09%09Assert.assertEquals(collection, list);%0A
 %09%7D%0A%0A%7D%0A

Check also list conversions