FinalMappings implements IFinalMapping { @Override synchronized public Iterator<Map<Integer, Integer>> getIterator() { Iterator<Map<Integer, Integer>> iterator = mappings.iterator(); return iterator; } protected  FinalMappings(); synchronized static FinalMappings getInstance(); @Override synchronized void add(Map<Integer, Integer> mapping); @Override synchronized final void set(List<Map<Integer, Integer>> list); @Override synchronized Iterator<Map<Integer, Integer>> getIterator(); @Override synchronized void clear(); @Override synchronized List<Map<Integer, Integer>> getFinalMapping(); @Override synchronized int getSize();  }
@Test public void testGetIterator() { Map<Integer, Integer> mapping1 = new TreeMap<Integer, Integer>(); mapping1.put(1, 1); mapping1.put(2, 2); mapping1.put(3, 3); Map<Integer, Integer> mapping2 = new TreeMap<Integer, Integer>(); mapping2.put(1, 2); mapping2.put(2, 1); mapping2.put(3, 3); List<Map<Integer, Integer>> mappings = new ArrayList<Map<Integer, Integer>>(2); mappings.add(mapping1); mappings.add(mapping2); FinalMappings instance = new FinalMappings(); instance.set(mappings); Iterator<Map<Integer, Integer>> result = instance.getIterator(); assertEquals(true, result.hasNext()); }