package ru.apetrov;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import java.io.*;

/**
 * Created by Andrey on 05.11.2016.
 */
//@Ignore
public class CheckByteStreamTest {

    CheckByteStream cbs = new CheckByteStream();
    boolean result = false;

    @Test
    public void whenInputEvenNumberThenCheckNumber(){
        InputStream inputStream = new ByteArrayInputStream("4".getBytes());
        try {
            result = cbs.isNumber(inputStream);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                inputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        assertTrue(result);
    }

    @Test
    public void whenInputOddNumberThenCheckNumber(){
        InputStream inputStream = new ByteArrayInputStream("3".getBytes());
        try {
            result = cbs.isNumber(inputStream);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                inputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        assertFalse(result);
    }
}

@@ -53,58 +53,8 @@
 *;%0A%0A
-import org.junit.Before;%0Aimport org.junit.Ignore;%0A
 impo
@@ -140,18 +140,8 @@
  */%0A
-//@Ignore%0A
 publ
@@ -280,42 +280,13 @@
 oid 
-whenInputEvenNumberThenCheckNumber
+test1
 ()%7B%0A
@@ -285,32 +285,36 @@
 est1()%7B%0A        
+try(
 InputStream inpu
@@ -359,38 +359,25 @@
 .getBytes())
-;%0A        try 
+)
 %7B%0A          
@@ -485,172 +485,8 @@
 ();%0A
-        %7D finally %7B%0A            try %7B%0A                inputStream.close();%0A            %7D catch (IOException e) %7B%0A                e.printStackTrace();%0A            %7D%0A
     
@@ -556,41 +556,13 @@
 oid 
-whenInputOddNumberThenCheckNumber
+test2
 ()%7B%0A
@@ -569,16 +569,20 @@
         
+try(
 InputStr
@@ -643,21 +643,9 @@
 s())
-;%0A        try
+)
  %7B%0A 
@@ -762,172 +762,8 @@
 ();%0A
-        %7D finally %7B%0A            try %7B%0A                inputStream.close();%0A            %7D catch (IOException e) %7B%0A                e.printStackTrace();%0A            %7D%0A
     

Update CheckByteStream