public void testAddLocationAndGetLocations(){
        try{
            Locations l = new Locations();
            l.addLocation(null);
            assertTrue(false);
        }catch(AssertionError e){
            assertTrue(true);
        };

        Location loc1 = new Location(0,0);
        Location loc2 = new Location(0,0);
        Location loc3 = new Location(1,0);
        Location loc4 = new Location(1,1);

        Locations l = new Locations();
        l.addLocation(loc1);
        Iterator<Location> iter = l.iterator();
        assertTrue(iter.hasNext());
        Location loc = iter.next();
        assertTrue(loc == loc1);
        assertTrue(loc != loc2);
        assertFalse(iter.hasNext());

        l.addLocation(loc2);
        iter = l.iterator();
        assertTrue(iter.hasNext());
        loc = iter.next();
        assertTrue(loc == loc1);
        assertTrue(loc != loc2);
        assertFalse(iter.hasNext());

        l.addLocation(loc3);
        iter = l.iterator();
        assertTrue(iter.hasNext());
        loc = iter.next();
        assertTrue(loc.equals(loc1) || loc.equals(loc3));
        assertTrue(loc != loc2);
        assertTrue(iter.hasNext());
        loc = iter.next();
        assertTrue(loc.equals(loc1) || loc.equals(loc3));
        assertFalse(iter.hasNext());

        l.addLocation(loc4);
        iter = l.iterator();
        assertTrue(iter.hasNext());
        loc = iter.next();
        assertTrue(loc.equals(loc1) || loc.equals(loc3) || loc.equals(loc4));
        assertTrue(loc != loc2);
        assertTrue(iter.hasNext());
        loc = iter.next();
        assertTrue(loc.equals(loc1) || loc.equals(loc3) || loc.equals(loc4));
        assertTrue(iter.hasNext());
        loc = iter.next();
        assertTrue(loc.equals(loc1) || loc.equals(loc3) || loc.equals(loc4));
        assertFalse(iter.hasNext());
        
    	System.out.print( "LocationsTest " );
    	System.out.println( "PASSED" );
    }