import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

public class MessageBuilderTester
{
    @Test
    public void testConstructorAgainstExamples()
    {
        MessageBuilder.wordsForTesting = new String[] {
             "the", "book", "on", "the", "table" };
        MessageBuilder.currentWordIndex = 0;
        
        MessageBuilder mb = new MessageBuilder("the");
        assertEquals("the book on the table", mb.message);
        assertEquals(5, mb.numWords);
        
        
        MessageBuilder.wordsForTesting = new String[] {
                "good", "morning", "sunshine" };
        MessageBuilder.currentWordIndex = 0;
        
        mb = new MessageBuilder("good");
        assertEquals("good morning sunshine", mb.message);
        assertEquals(3, mb.numWords);
    }
    
    @Test
    public void testGetAbbreviationAgainstExample()
    {
        MessageBuilder mb = new MessageBuilder();
        mb.message = "as soon as possible";
        mb.numWords = 4;
        assertEquals("asap", mb.getAbbreviation());
    }
}
