@@ -0,0 +1,1961 @@
+package ru.matevosyan.server;%0A%0Aimport org.junit.Test;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%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 25.03.2017.%0A */%0A%0Apublic class BotServerTest %7B%0A%0A    private static final String LN = System.getProperty(%22line.separator%22);%0A    private static final String EMPTYSTRING = System.getProperty(%22line.separator%22);%0A%0A%0A    private void whenClientAskThenServerAnswer(String input, String expected) throws IOException %7B%0A        Socket socket = mock(Socket.class);%0A%0A        ByteArrayOutputStream out = new ByteArrayOutputStream();%0A        ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes());%0A%0A        when(socket.getInputStream()).thenReturn(in);%0A        when(socket.getOutputStream()).thenReturn(out);%0A        BotServer botServer = new BotServer(socket);%0A%0A        botServer.startServerWork();%0A%0A        assertThat(out.toString(), is(expected));%0A%0A    %7D%0A%0A    @Test%0A    public void whenClientAskForExitThenServerAnswerEmpty() throws IOException %7B%0A%0A        this.whenClientAskThenServerAnswer(%22Bye%22, %22%22);%0A%0A    %7D%0A%0A    @Test%0A    public void whenClientAskForBlaBlaThenServerAnswerDoNotUnderstand() throws IOException %7B%0A%0A        this.whenClientAskThenServerAnswer(String.format(%22sdfsdsdfsdfsdf%25sBye%22, LN),%0A                %22What do you want. I don't understand you!%22 + EMPTYSTRING);%0A%0A    %7D%0A%0A    @Test%0A    public void whenClientAskForBlaBlaTwoTimesThenServerAnswerDoNotUnderstandTwoTimes() throws IOException %7B%0A%0A        this.whenClientAskThenServerAnswer(String.format(%22sdfsdsdfsdfsdf%25sBsdssdsdsdsdy%25sBye%22, LN, LN),%0A                %22What do you want. I don't understand you!%22 + EMPTYSTRING +%0A                        %22What do you want. I don't understand you!%22 + EMPTYSTRING);%0A%0A    %7D%0A%0A%7D

add BotServerTest.java