package ru.job4j.array;

import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

/**
 * Class JUnit тест класса ArrayDuplicate task 6.5.3.
 * @author Nikolai Matveev
 * @since 6.10.2017
 * @version 0.1
 */

public class ArrayDuplicateTest {

	/**
	 * Нахождение дубликатов.
	 * {"Привет", "Мир", "Привет", "Супер", "Мир"}
	 */
	@Test
	public void whenRemoveFiveSizeArrayTwoDuplicate() {
		ArrayDuplicate remove = new ArrayDuplicate();
		String[] original = {"Привет", "Мир", "Привет", "Супер", "Мир"};
		String[] expect = {"Привет", "Мир", "Супер"};
		assertThat(remove.remove(original), is(expect));

	}

	/**
	 * Нахождение дубликатов.
	 * {"Мир", "Мир", "Мир", "Мир", "Мир"}
	 */
	@Test
	public void whenRemoveFiveSizeArrayAllDuplicate() {
		ArrayDuplicate remove = new ArrayDuplicate();
		String[] original = {"Мир", "Мир", "Мир", "Мир", "Мир"};
		String[] expect = {"Мир"};
		assertThat(remove.remove(original), is(expect));

	}

	/**
	 * Нахождение дубликатов.
	 * {"Привет", "Мир", "Стол", "Стол"}
	 */
	@Test
	public void whenRemoveFourSizeArrayTwoDuplicate() {
		ArrayDuplicate remove = new ArrayDuplicate();
		String[] original = {"Привет", "Мир", "Стол", "Стол"};
		String[] expect = {"Привет", "Мир", "Стол"};
		assertThat(remove.remove(original), is(expect));

	}

	/**
	 * Нахождение дубликатов.
	 * {"Привет", "Мир", "Стол", "Стол", "Мир", "Привет"}
	 */
	@Test
	public void whenRemoveFourSixArrayThreeDuplicate() {
		ArrayDuplicate remove = new ArrayDuplicate();
		String[] original = {"Привет", "Мир", "Стол", "Стол", "Мир", "Привет"};
		String[] expect = {"Привет", "Мир", "Стол"};
		assertThat(remove.remove(original), is(expect));

	}
}