@@ -0,0 +1,1953 @@
+package ru.matevosyan.client;%0A%0Aimport org.junit.Test;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.PrintStream;%0Aimport java.net.Socket;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0A/**%0A * Created by Admin on 26.03.2017.%0A */%0Apublic class BotClientTest %7B%0A%0A    private static final String LN = System.getProperty(%22line.separator%22);%0A%0A    public void whenClientSendThenServerReturn(String input, String expected, String typeIn) throws IOException %7B%0A        Socket socket = mock(Socket.class);%0A        ByteArrayOutputStream outType = new ByteArrayOutputStream();%0A        System.setOut(new PrintStream(outType));%0A%0A        ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes());%0A        ByteArrayOutputStream out = new ByteArrayOutputStream();%0A        ByteArrayInputStream typeValue = new ByteArrayInputStream(typeIn.getBytes());%0A%0A        System.setIn(typeValue);%0A        when(socket.getInputStream()).thenReturn(in);%0A        when(socket.getOutputStream()).thenReturn(out);%0A%0A%0A        BotClient botClient = new BotClient(socket);%0A%0A        botClient.startClient();%0A%0A        assertThat(outType.toString(%22UTF-8%22), is(expected));%0A    %7D%0A%0A%0A    @Test%0A    public void whenSendHelloThenReturnHello() throws IOException %7B%0A        this.whenClientSendThenServerReturn(%22Hello my friend%22,%0A                String.format(%22Type something to send to Oracle%25sSending this line to the server...%25s%22 +%0A                                %22Server ~ Hello my friend%25sSending this line to the server...%25sServer ~ null%25s%22,%0A                        LN, LN, LN, LN, LN),%0A                String.format(%22Hello%25sBye%22, LN));%0A    %7D%0A//    @Test%0A//    public void whenSendByThenReturnEmpty() throws IOException %7B%0A//        this.whenClientSendThenServerReturn(%22%22, %22%22, %22Bye%22);%0A//    %7D%0A%7D

add BotClientTest.java