package de.ugoe.cs.util;

import org.junit.*;
import static org.junit.Assert.*;

/**
 * The class <code>ArrayToolsTest</code> contains tests for the class
 * <code>{@link ArrayTools}</code>.
 * 
 * @author Steffen Herbold
 * @version 1.0
 */
public class ArrayToolsTest {

	Integer array[];

	@Test
	public void testFindIndex_1() throws Exception {

		Integer target = 3;
		int expected = 3;

		int result = ArrayTools.findIndex(array, target);

		// add additional test code here
		assertEquals(expected, result);
	}

	@Test
	public void testFindIndex_2() throws Exception {

		Integer target = 4;
		int expected = 4;

		int result = ArrayTools.findIndex(array, target);

		// add additional test code here
		assertEquals(expected, result);
	}

	@Test
	public void testFindIndex_3() throws Exception {
		Integer target = 7;

		int result = ArrayTools.findIndex(array, target);
		int expected = -1;

		// add additional test code here
		assertEquals(expected, result);
	}

	@Test
	public void testFindIndex_4() throws Exception {
		Integer target = null;
		int result = ArrayTools.findIndex(array, target);
		int expected = 7;
		assertEquals(expected, result);
	}

	@Test
	public void testFindIndex_5() throws Exception {
		Object[] array = new Object[0];
		Object other = new Object();

		int result = ArrayTools.findIndex(array, other);

		// add additional test code here
		assertEquals(-1, result);
	}

	@Before
	public void setUp() throws Exception {
		array = new Integer[] { 0, 1, 2, 3, 4, 4, 5, null, 6 };
	}

	public static void main(String[] args) {
		new org.junit.runner.JUnitCore().run(ArrayToolsTest.class);
	}
}