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 P15Test { @Test public void shouldDuplicateElementsInAList() throws Exception { List<String> duplicates = P15.duplicate(Arrays.asList("a", "b", "c"), 3); assertThat(duplicates, hasSize(9)); assertThat(duplicates, contains("a", "a", "a", "b", "b", "b", "c", "c", "c")); } }