package ru.job4j.io;

import org.junit.Test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

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

/**
 * Class RemoveForbiddenWordsTest.
 *
 * @author Ponkin Aleksey
 * @version 1.0.0
 * @since 23.01.2019.
 */
public class RemoveForbiddenWordsTest {

    @Test
    public void whenTextContainsOneAbuseWord() {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ByteArrayInputStream in = new ByteArrayInputStream("Test text with one abuse word".getBytes());
        String[] abuse = new String[] {"abuse"};
        new RemoveForbiddenWords().dropAbuse(in, out, abuse);
        assertThat(out.toString(), is("Test text with one word"));
    }

    @Test
    public void whenTextContainsTwoAbuseWord() {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ByteArrayInputStream in = new ByteArrayInputStream("Test text with one abuse and one bad word".getBytes());
        String[] abuse = new String[] {"abuse", "bad"};
        new RemoveForbiddenWords().dropAbuse(in, out, abuse);
        assertThat(out.toString(), is("Test text with one and one word"));
    }
}
@@ -352,16 +352,82 @@
 Test %7B%0A%0A
+    /**%0A     * Test when contains one abuse word in text.%0A     */%0A
     @Tes
@@ -420,32 +420,32 @@
    */%0A    @Test%0A
-
     public void 
@@ -831,16 +831,82 @@
 %0A    %7D%0A%0A
+    /**%0A     * Test when contains two abuse word in text.%0A     */%0A
     @Tes
@@ -1247,32 +1247,32 @@
 n, out, abuse);%0A
-
         assertTh
@@ -1335,10 +1335,554 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Test when contains two abuse word in text with punctuation char.%0A     */%0A    @Test%0A    public void whenTextContainsTwoAbuseWordAndPunctuationChar() %7B%0A        ByteArrayOutputStream out = new ByteArrayOutputStream();%0A    ByteArrayInputStream in = new ByteArrayInputStream(%22Test text with one abuse and one bad word!%22.getBytes());%0A        String%5B%5D abuse = new String%5B%5D %7B%22abuse%22, %22bad%22%7D;%0A        new RemoveForbiddenWords().dropAbuse(in, out, abuse);%0A        assertThat(out.toString(), is(%22Test text with one and one word!%22));%0A    %7D
 %0A%7D

Add test.