package ru.matevosyan;

import org.junit.Test;

import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.ArrayList;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;


public class EfficiencyListTest {
    @Test
    public void whenAddThousendAndFiveToTreeSetThanReturnFive() {

        //assign
        final String LN = System.getProperty("line.separator");
        Set<String> treeSet = new TreeSet<>();

        EfficiencyList efficiencyList = new EfficiencyList();

        //act
        System.out.printf("TreeSet%s", LN);

        long timeAddTeeSet = efficiencyList.add(treeSet, "treeSet", 2_000_000);
        int expectedTreeSet = treeSet.size();
        long timeRemoveTreeSet = efficiencyList.delete(treeSet, 500);

        System.out.printf(String.format("Add time --- %s%sRemove time  --- %s%s", timeAddTeeSet, LN,
                timeRemoveTreeSet, LN));
//        int i = 0;
//        for (String str : treeSet) {
//
//            System.out.printf("%s. element --- %s%s", i++, str, LN);
//        }
//        System.out.printf("Amount --- %s%s%s", i, LN, LN);

        //assert
//        assertThat(i, is(999_500));
        assertThat(expectedTreeSet, is(2_000_000));
    }
    @Test
    public void whenAddThousendAndFiveToArrayListThanReturnFive() {

        //assign
        final String LN = System.getProperty("line.separator");
        List<String> arrayList = new ArrayList<>();

        EfficiencyList efficiencyList = new EfficiencyList();

        //act
        System.out.printf("ArrayList%s", LN);

        long timeAddArray = efficiencyList.add(arrayList, "Linked", 2_000_000);
        int expectedArrayList = arrayList.size();
        long timeRemoveArray = efficiencyList.delete(arrayList, 500);

        System.out.printf(String.format("Add time --- %s%sRemove time --- %s%s",
                timeAddArray, LN, timeRemoveArray, LN));
//        int i = 0;
//        for (String str : arrayList) {
//
//            System.out.printf("%s. element --- %s%s", i++, str, LN);
//        }
//        System.out.printf("Amount --- %s%s%s", i, LN, LN);

        //assert
//        assertThat(i, is(999_500));
        assertThat(expectedArrayList, is(2_000_000));
    }

    @Test
    public void whenAddThousendAndFiveToLinkedListThanReturnFive() {

        //assign
        final String LN = System.getProperty("line.separator");
        List<String> linkedList = new LinkedList<>();

        EfficiencyList efficiencyList = new EfficiencyList();

        //act
        System.out.printf("LinkedList%s", LN);

        long timeAddLinkedList = efficiencyList.add(linkedList, "Linked", 2_000_000);
        int expectedLinkedList = linkedList.size();
        long timeRemoveLinkedList = efficiencyList.delete(linkedList, 500);

        System.out.print(String.format("Add time --- %s%sRemove time --- %s%s", timeAddLinkedList, LN,
                timeRemoveLinkedList, LN));

//        int i = 0;
//        for (String str : linkedList) {
//
//            System.out.printf("%s. element --- %s%s", i++, str, LN);
//        }
//        System.out.printf("Amount --- %s%s%s", i, LN, LN);

        //assert
//        assertThat(i, is(999_500));
        assertThat(expectedLinkedList, is(2_000_000));
    }



}
@@ -299,16 +299,119 @@
 tTest %7B%0A
+%0A    private static final int STRINGAMOUNT = 2000;%0A    private static final int STRINGTODELETE = 100;%0A%0A
     @Tes
@@ -432,33 +432,33 @@
 oid whenAddThous
-e
+a
 ndAndFiveToTreeS
@@ -798,25 +798,28 @@
 eeSet%22, 
-2_000_000
+STRINGAMOUNT
 );%0A     
@@ -923,19 +923,30 @@
 reeSet, 
-500
+STRINGTODELETE
 );%0A%0A    
@@ -1079,34 +1079,32 @@
 eSet, LN));%0A
-//
         
 int i = 0;%0A/
@@ -1095,255 +1095,57 @@
     
-int i = 0;%0A//        for (String str : treeSet) %7B%0A//%0A//            System.out.printf(%22%25s. element --- %25s%25s%22, i++, str, LN);%0A//        %7D%0A//        System.out.printf(%22Amount --- %25s%25s%25s%22, i, LN, LN);%0A%0A        //assert%0A//        assertThat(i, is(999_5
+//assert%0A        assertThat(treeSet.size(), is(19
 00))
@@ -1181,33 +1181,36 @@
 TreeSet, is(
-2_000_000
+STRINGAMOUNT
 ));%0A    %7D%0A  
@@ -1237,33 +1237,33 @@
 oid whenAddThous
-e
+a
 ndAndFiveToArray
@@ -1603,34 +1603,40 @@
 yList, %22
-Linked%22, 2_000_000
+ArrayList%22, STRINGAMOUNT
 );%0A     
@@ -1740,27 +1740,38 @@
 (arrayList, 
-500
+STRINGTODELETE
 );%0A%0A        
@@ -1903,217 +1903,8 @@
 N));
-%0A//        int i = 0;%0A//        for (String str : arrayList) %7B%0A//%0A//            System.out.printf(%22%25s. element --- %25s%25s%22, i++, str, LN);%0A//        %7D%0A//        System.out.printf(%22Amount --- %25s%25s%25s%22, i, LN, LN);
 %0A%0A  
@@ -1910,34 +1910,32 @@
        //assert%0A
-//
         assertTh
@@ -1933,35 +1933,47 @@
  assertThat(
-i, is(999_5
+arrayList.size(), is(19
 00));%0A      
@@ -2003,33 +2003,36 @@
 rayList, is(
-2_000_000
+STRINGAMOUNT
 ));%0A    %7D%0A%0A 
@@ -2068,17 +2068,17 @@
 AddThous
-e
+a
 ndAndFiv
@@ -2445,25 +2445,28 @@
 inked%22, 
-2_000_000
+STRINGAMOUNT
 );%0A     
@@ -2582,19 +2582,30 @@
 edList, 
-500
+STRINGTODELETE
 );%0A%0A    
@@ -2752,219 +2752,8 @@
 );%0A%0A
-//        int i = 0;%0A//        for (String str : linkedList) %7B%0A//%0A//            System.out.printf(%22%25s. element --- %25s%25s%22, i++, str, LN);%0A//        %7D%0A//        System.out.printf(%22Amount --- %25s%25s%25s%22, i, LN, LN);%0A%0A
     
@@ -2765,18 +2765,16 @@
 /assert%0A
-//
         
@@ -2788,19 +2788,32 @@
 hat(
-i, is(999_5
+linkedList.size(), is(19
 00))
@@ -2860,17 +2860,20 @@
  is(
-2_000_000
+STRINGAMOUNT
 ));%0A

add private static final two variable