package org.jstanier;

import static org.mockito.Mockito.when;

import java.io.StringReader;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;

import com.jstanier.InputParser;
import com.jstanier.InputReader;

@RunWith(MockitoJUnitRunner.class)
public class InputParserTest {

    private static final String ONE_LINE_VALID_CSV = "1,\"The content of your tweet\"";

    @Mock
    private InputReader inputReader;

    @InjectMocks
    private InputParser inputParser;

    @Test
    public void parseInput_givenGivenOneCsvLine_thenOneTweetToScheduleIsReturned() {
        when(inputReader.getInputReader(Mockito.anyString())).thenReturn(
                new StringReader(ONE_LINE_VALID_CSV));
        inputParser.parseInput(ONE_LINE_VALID_CSV);
    }
}

@@ -497,16 +497,169 @@
 weet%5C%22%22;
+%0A    private static final String ONE_LINE_INVALID_DELIMITER_CSV = %221;%5C%22The content of your tweet%5C%22%22;%0A    private static final String NUMBER_STRING = %221%22;
 %0A%0A    @M
@@ -1036,11 +1036,721 @@
 );%0A    %7D
+%0A%0A    @Test(expected = NumberFormatException.class)%0A    public void parseInput_givenGivenOneCsvLineWithInvalidDelimiter_thenANumberFormatExceptionIsThrown() %7B%0A        when(inputReader.getInputReader(Mockito.anyString())).thenReturn(%0A                new StringReader(ONE_LINE_INVALID_DELIMITER_CSV));%0A        inputParser.parseInput(ONE_LINE_INVALID_DELIMITER_CSV);%0A    %7D%0A%0A    @Test(expected = ArrayIndexOutOfBoundsException.class)%0A    public void parseInput_givenAStringWithOnlyANumber_thenAnArrayIndexOutOfBoundsExceptionIsThrown() %7B%0A        when(inputReader.getInputReader(Mockito.anyString())).thenReturn(%0A                new StringReader(NUMBER_STRING));%0A        inputParser.parseInput(NUMBER_STRING);%0A    %7D
 %0A%7D%0A

Add tests for incorrect input