package ru.job4j;

import java.util.*;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

/**.
* Chapter_003
* Task 3.1.2
* Test check time for other collection
*
* @author Anton Vasilyuk
* @version 1.0
* @since 0.1
*/
public class CheckTimeTest {

	/**.
	* Test time for add element
	*/
	@Test
	public void whenNeedCheckTimeAddElementThenLookTime() {

		CheckTime checkTime = new CheckTime();

		List<String> wordsLink = new LinkedList<>();
		List<String> wordsArray = new ArrayList<>();
		Set<String> wordsTree = new TreeSet<>();

		String line = "a";
		int amount = 10000;

		long timeOperationLink = checkTime.add(wordsLink, line, amount);
		long timeOperationArray = checkTime.add(wordsArray, line, amount);
		long timeOperationTree = checkTime.add(wordsTree, line, amount);

		System.out.println(timeOperationLink);
		System.out.println(timeOperationArray);
		System.out.println(timeOperationTree);

		boolean fact = false;
		if (timeOperationLink > 0 && timeOperationArray > 0 && timeOperationTree > 0) {fact = true;}
		boolean expected = true;

		assertThat(fact, is(expected));
	}

	/**.
	 * Test time for add element
	 */
	@Test
	public void whenNeedCheckTimeDeleteElementThenLookTime() {

		CheckTime checkTime = new CheckTime();

		List<String> wordsLink = new LinkedList<>();
		List<String> wordsArray = new ArrayList<>();
		Set<String> wordsTree = new TreeSet<>();

		String line = "a";
		int amount = 10000;

		checkTime.add(wordsLink, line, amount);
		long timeOperationLink = checkTime.delete(wordsLink, amount);
		checkTime.add(wordsArray, line, amount);
		long timeOperationArray = checkTime.delete(wordsArray, amount);
		checkTime.add(wordsTree, line, amount);
		long timeOperationTree = checkTime.delete(wordsTree, amount);

		System.out.println(timeOperationLink);
		System.out.println(timeOperationArray);
		System.out.println(timeOperationTree);

		boolean fact = false;
		if (timeOperationLink > 0) {fact = true;}
		boolean expected = true;

		assertThat(fact, is(expected));
	}
}
@@ -591,33 +591,36 @@
 %09String line = %22
-a
+Ship
 %22;%0A%09%09int amount 
@@ -622,24 +622,26 @@
 ount = 10000
+00
 ;%0A%0A%09%09long ti
@@ -1451,17 +1451,20 @@
 line = %22
-a
+Ship
 %22;%0A%09%09int
@@ -1474,24 +1474,26 @@
 ount = 10000
+00
 ;%0A%0A%09%09checkTi
@@ -1580,22 +1580,22 @@
 dsLink, 
-amount
+500000
 );%0A%09%09che
@@ -1689,22 +1689,22 @@
 sArray, 
-amount
+500000
 );%0A%09%09che
@@ -1795,22 +1795,22 @@
 dsTree, 
-amount
+500000
 );%0A%0A%09%09Sy

add file for chapter_003_3.1.2