### Question:
StructValue extends HashMap<Field, Object> implements Iterable<Map.Entry<Field, Object>> { public final Iterator<Map.Entry<Field, Object>> iterator() { return entrySet().iterator(); } StructValue( Type type, ValueFactory vf );  StructValue( Type type, ValueFactory vf, int length ); Type type(); Level level(); boolean isType( Type otherType ); void checkType( Type expectedType ); final Iterator<Map.Entry<Field, Object>> iterator(); @Override final Object put( Field key, Object value ); @Override String toString();  }### Answer:
@Test public void iterator() { StructValue sv = new StructValue( mt1, vf ); assertFalse( sv.iterator().hasNext() ); sv.put( mf1, true ); Iterator<Map.Entry<Field, Object>> i = sv.iterator(); assertTrue( i.hasNext() ); Map.Entry<Field, Object> me = i.next(); assertSame( mf1, me.getKey() ); assertEquals( true, me.getValue() ); assertFalse( i.hasNext() ); Map<Field, Object> vals = new HashMap<Field, Object>(); vals.put( mf1, true ); vals.put( mf3, 2 ); vals.put( mf5, "a" ); sv.put( mf3, 2 ); sv.put( mf5, "a" ); i = sv.iterator(); while (i.hasNext()) { me = i.next(); Field key = me.getKey(); assertTrue( vals.containsKey( key ) ); assertEquals( vals.remove( key ), me.getValue() ); } assertTrue( vals.isEmpty() ); }