package ru.job4j.threads;

import org.junit.Test;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.*;

/**
 * Class <Name class>.
 *
 * @author Alexey Rastorguev (rastorguev00@gmail.com)
 * @version 0.1
 * @since 29.01.2018
 */
public class FoundToTextTest {
    @Test
    public void whenFindWordAndSpaceThreadThenPrint() throws InterruptedException {
        Runnable runnable1 = new FoundToText("aa bb cc");
        Thread t1 = new Thread(runnable1);

        Runnable runnable2 = new FoundToText("aa bb cc dddd eeeeeee");
        Thread  t2 = new Thread(runnable2);

        t1.start();
        t2.start();

        Thread.sleep(1000);
        assertThat(((FoundToText) runnable1).getCountWord(), is(3));
    }

}
@@ -583,24 +583,25 @@
 unnable2);%0A%0A
+%0A
         t1.s
@@ -628,25 +628,24 @@
 tart();%0A
-%0A
         
 Thread.s
@@ -640,27 +640,56 @@
     
-Thread.sleep(1000);
+while (t1.isAlive() & t2.isAlive()) %7B%0A        %7D%0A
 %0A   
@@ -754,16 +754,17 @@
 is(3));%0A
+%0A
     %7D%0A%0A%7D

add ожидание вывода [task #1017]