package ru.job4j.strategy;

import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

/**
 * Test.
 *
 * @author Stanislav (376825@mail.ru)
 * @version $Id$
 * @since 1.0
 */
public class PaintTest {
    /**
     * Test add.
     */
    @Test
    public void whenStrategySquareThenPrintSquare() {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        System.setOut(new PrintStream(out));
        Paint paint = new Paint();
        paint.setStrategy(new Square());

        paint.draw();

        String expected = "++++\r\n++++\r\n++++\r\n++++\r\n";

        assertThat(out.toString(), is(expected));
    }

    /**
     * Test add.
     */
    @Test
    public void whenStrategyTriangleThenPrintTriangle() {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        System.setOut(new PrintStream(out));
        Paint paint = new Paint();
        paint.setStrategy(new Triangle());

        paint.draw();

        String expected = "   +   \r\n  +++  \r\n +++++ \r\n+++++++\r\n";

        assertThat(out.toString(), is(expected));
    }
}
@@ -606,32 +606,33 @@
  paint.draw();%0A%0A
+%0A
         String e
@@ -650,37 +650,152 @@
 ++++
-%5Cr%5Cn++++%5Cr%5Cn++++%5Cr%5Cn++++%5Cr%5Cn%22
+%22 + System.lineSeparator() + %22++++%22 + System.lineSeparator()%0A                + %22++++%22 + System.lineSeparator() + %22++++%22 + System.lineSeparator()
 ;%0A%0A 
@@ -1201,46 +1201,161 @@
 +   
-%5Cr%5Cn  +++  %5Cr%5Cn +++++ %5Cr%5Cn+++++++%5Cr%5Cn%22
+%22 + System.lineSeparator() + %22  +++  %22 + System.lineSeparator()%0A                + %22 +++++ %22 + System.lineSeparator() + %22+++++++%22 + System.lineSeparator()
 ;%0A%0A 

fix error test in chapter_002