package com.shekhargulati.ninetynine_problems._01_lists; import org.junit.Test; import java.util.Arrays; import java.util.List; import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.hamcrest.collection.IsIterableContainingInOrder.contains; import static org.junit.Assert.assertThat; public class P14Test { @Test public void shouldDuplicateElementsInAList() throws Exception { List<String> duplicates = P14.duplicate(Arrays.asList("a", "b", "c", "d")); assertThat(duplicates, hasSize(8)); assertThat(duplicates, contains("a", "a", "b", "b", "c", "c", "d", "d")); } }