package com.shekhargulati.ninetynine_problems._01_lists;
import org.junit.Test;
import java.util.List;
import static java.util.Arrays.asList;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
import static org.junit.Assert.assertThat;
public class P08Test {
@Test
public void shouldRemoveConsecutiveDuplicatesInAList() throws Exception {
List<String> compressedList = P08.compress(asList("a", "a", "a", "a", "b", "c", "c", "d", "e", "e", "e", "e"));
assertThat(compressedList, hasSize(5));
assertThat(compressedList, contains("a", "b", "c", "d", "e"));
}
@Test
public void shouldNotRemoveNonConsecutiveSimilarElementsFromAList() throws Exception {
List<String> compressedList = P08.compress(asList("a", "a", "a", "a", "b", "c", "c", "a", "a", "d", "e", "e", "e", "e"));
assertThat(compressedList, hasSize(6));
assertThat(compressedList, contains("a", "b", "c", "a", "d", "e"));
}
}