import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;
import java.util.Arrays;

public class MinMaxTest {


Arraz cool = new Arraz();
MoreArrayc moreArrays = new MoreArrayc();

    @Test
    public void getMin(){

        //Given

        Integer [] arr = {10,21,7,8,9,4,3};

        //When

        MinMax1.MinMax x  = MinMax1.findMaxnMin(arr);

        //Then
        Assert.assertEquals(3,x.min);

    }

    @Test
    public void getMax(){

        //Given

        Integer [] arr = {10,21,7,8,9,4,3};

        //When

        MinMax1.MinMax x  = MinMax1.findMaxnMin(arr);

        //Then
        Assert.assertEquals(21,x.max);

    }

    @Test
    public void averageArrayWithoutMaxMinTEST () {
        //Given

        Integer [] arr = {10,21,7,8,9,4,3};
        MinMax1.MinMax x  = MinMax1.findMaxnMin(arr);
        Integer [] arr2 = new Integer[arr.length];


        //When
        for (int i = 0; i < arr.length ; i++) {


            if(!arr[i].equals(x.max) && !arr[i].equals(x.min)){

                arr2[i] = arr[i];
            }

        }

        Integer[] arr3 = moreArrays.copyArrayByIteratingthroughIt(arr2);


        //Then
        for (int i = 0; i <arr3.length; i++) {
            System.out.print(arr3[i]);
        }
         //   Assert.assertEquals(6,getAvg);
    }

    @Test
    public void  arraysHas65N77TESTFAIL () {


        //Given

        Integer [] arr = {89,21,7,8,65,4,3};
        Integer n = 65;
        Integer k = 77;

        //When

        Boolean actual = moreArrays.arraysHas65N77(arr,n,k);
        //then


        Assert.assertFalse(actual);

    }


    @Test
    public void  arraysHas65N77TESTWIN () {


        //Given

        Integer [] arr = {77,21,7,8,65,4,3};
        Integer n = 65;
        Integer k = 77;

        //When

        Boolean actual = moreArrays.arraysHas65N77(arr,n,k);
        //then


        Assert.assertTrue(actual);

    }


}
