package ru.job4j;

import org.junit.Test;

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

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
 * Created by Anton on 17.02.2017.
 */
public class DeleteTest {
    /**
     *
     * @throws Exception Exception
     */
    @Test
    public void whenSetStreamThenDeleteWorld() throws Exception {
        final String s = "one\r\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\n";
        final String[] words = {"two", "four"};
        final String expected = "one\ncensor\nthree\ncensor\nfive\nsix\nseven\neight\nnine\nten\n";
        byte[] bytes1 = s.getBytes();
        ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes1);
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        Delete delete = new Delete();
        delete.dropAbuses(inputStream, outputStream, words);
        String result = outputStream.toString();
        inputStream.close();
        outputStream.close();
        assertThat(result, is(expected));
    }
}

@@ -433,16 +433,21 @@
 e%5Cr%5Cntwo
+ sada
 %5Cnthree%5C
@@ -447,16 +447,22 @@
 nthree%5Cn
+asdad 
 four%5Cnfi
@@ -590,16 +590,21 @@
 %5Cncensor
+ sada
 %5Cnthree%5C
@@ -604,16 +604,22 @@
 nthree%5Cn
+asdad 
 censor%5Cn

update 2.0