import static org.junit.Assert.assertTrue;

import java.util.ArrayList;

import org.junit.jupiter.api.Test;

public class ThreeTest
{
    @Test
    public void testPartAAgainstExamples()
    {
        WordChecker wc = new WordChecker();
        wc.wordList = new ArrayList<String>();
        wc.wordList.add("an");
        wc.wordList.add("band");
        wc.wordList.add("band");
        wc.wordList.add("abandon");
        
        assertTrue(wc.isWordChain());
        
        
        wc.wordList.clear();
        wc.wordList.add("to");
        wc.wordList.add("too");
        wc.wordList.add("stool");
        wc.wordList.add("tools");
        
        assertTrue( ! wc.isWordChain() );
    }
    
    @Test
    public void testPartBAgainstExamples()
    {
        WordChecker wc = new WordChecker();
        wc.wordList = new ArrayList<String>();
        wc.wordList.add("catch");
        wc.wordList.add("bobcat");
        wc.wordList.add("catchacat");
        wc.wordList.add("cat");
        wc.wordList.add("at");
        
        ArrayList<String> expected = new ArrayList<String>();
        expected.add("ch");
        expected.add("chacat");
        expected.add("");
        
        assertTrue(expected.equals(wc.createList("cat")));
        
        
        expected.clear();
        expected.add("");
        expected.add("acat");
        
        assertTrue(expected.equals(wc.createList("catch")));
        
        
        assertTrue(wc.createList("dog").size() == 0);
    }
}
