// ***********************************************************************
//
// Test1 -- An example test : Tests remove() on last value in chain
//	
// ***********************************************************************
// Computer Science 102: Data Structures
// New York University, Fall 2013,
//
// Lecturers: Eric Koskinen and Daniel Schwartz-Narbonne
//
// ***********************************************************************

public class Test3 extends TestHarness {

    public Test3(String s) { super(s); }

    public boolean test() { 
	Map<Integer, Integer> m = new HashTable<Integer,Integer>
	    (10, new GenericHasher<Integer>());

	try {
		m.put(1, 1);
		m.put(2, 2);
		m.put(3, 3);
		boolean test1 = m.remove(1);
		Integer test2 = m.get(2);
		Integer test3 = m.get(3);
		Integer test4 = m.get(1);
		boolean test5 = m.remove(1);
		if(test1!=true || test2!=2 || test3!=3 || test4!=null || test5 != false)
		{
			return false;
		}
	    return true;
	}catch (Exception e){
		//if we catch an Exception, threw incorrect exception
		return false;
	}
    }
}
