### Question:
ScraperContext implements DynamicScopeContext { @Override @SuppressWarnings({"unchecked"}) public Iterator<KeyValuePair<Variable>> iterator() { return IteratorUtils.transformedIterator(centralReferenceTable.entrySet().iterator(), new Transformer() { @Override public Object transform(Object input) { final Map.Entry<String, Stack<Variable>> crtEntry = (Map.Entry<String, Stack<Variable>>) input; return new KeyValuePair<Variable>(crtEntry.getKey(), crtEntry.getValue().peek()); } }); } ScraperContext(); @PostConstruct void initContext(); void setLocalVar(String name, Object value); @Override void setLocalVar(String name, Variable variable); @Override @SuppressWarnings({"ConstantConditions"}) Variable replaceExistingVar(String name, Variable variable); @Override Variable getVar(String name); @Override boolean containsVar(String name); @Override @SuppressWarnings({"unchecked"}) Iterator<KeyValuePair<Variable>> iterator(); @Override R executeWithinNewContext(Callable<R> callable); @Override // TODO Add unit test void setLocalVar(final Map<String, Object> map); @Override @Deprecated FunctionDef getFunctionDef(final String name); @Override @Deprecated void addFunctionDef(final FunctionDef funcDef); @Override @Deprecated ScriptingLanguage getScriptingLanguage(); @Override @Deprecated void setScriptingLanguage(final ScriptingLanguage language); @Override String getCharset(); @Override void setCharset(final String charset); @Override Config getConfig(); @Override @Deprecated void setConfig(final Config config);  }### Answer:
@Test public void testIterator() throws Exception { assertFalse(context.iterator().hasNext()); context.setLocalVar("z", "zzz"); context.setLocalVar("x", "will be overwritten"); context.setLocalVar("x", dummyVar); context.setLocalVar("y", dummyVar); assertReflectionEquals(Arrays.asList( new KeyValuePair<Variable>("x", dummyVar), new KeyValuePair<Variable>("y", dummyVar), new KeyValuePair<Variable>("z", new NodeVariable("zzz"))), IteratorUtils.toList(context.iterator()), ReflectionComparatorMode.LENIENT_ORDER); }