@@ -0,0 +1,1717 @@
+/**%0A * This source file is subject to the license that is bundled with this package in the file LICENSE.%0A */%0Apackage com.codeup.console;%0A%0Aimport com.codeup.validation.Validator;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.PrintStream;%0Aimport java.util.Scanner;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.*;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class ConsoleTest %7B%0A    @Test%0A    public void it_accepts_a_valid_text() %7B%0A        when(validator.isValid(text)).thenReturn(true);%0A        console = new Console(getInput(text), output);%0A%0A        assertThat(console.promptForText(message, validator), is(text));%0A    %7D%0A%0A    @Test%0A    public void it_prompts_a_second_time_if_invalid_text_is_given() %7B%0A        when(validator.isValid(invalidText)).thenReturn(false);%0A        when(validator.isValid(text)).thenReturn(true);%0A        console = new Console(%0A            getInput(String.format(%22%25s%5Cn%25s%22, invalidText, text)),%0A            output%0A        );%0A%0A        assertThat(console.promptForText(message, validator), is(text));%0A        verify(validator).errorMessage();%0A    %7D%0A%0A    private Scanner getInput(String text) %7B%0A        return new Scanner(new ByteArrayInputStream(text.getBytes()))%0A            .useDelimiter(%22%5Cn%22)%0A        ;%0A    %7D%0A%0A    private Console console;%0A    private String message = %22Message%22;%0A    private String invalidText = %22invalid%22;%0A    private String text = %22text%22;%0A%0A    @Mock%0A    private PrintStream output;%0A%0A    @Mock%0A    private Validator validator;%0A%7D%0A

Create first tests for Console class.