/** Changes variable references in second script. */
public void testUpdateGlobalVarReferences_UpdateScriptNewRefs() {
Map<Var, ReferenceCollection> scriptMap = Maps.newHashMap();
ReferenceCollection newVar1Refs = new ReferenceCollection();
Reference newVar1In2Ref = createRefForTest(INPUT2);
newVar1Refs.references = Lists.newArrayList(newVar1In2Ref);
ReferenceCollection newVar2Refs = new ReferenceCollection();
Reference newVar2In2Ref = createRefForTest(INPUT2);
newVar2Refs.references = Lists.newArrayList(newVar2In2Ref);
ReferenceCollection newVar3Refs = new ReferenceCollection();
Reference newVar3In2Ref = createRefForTest(INPUT2);
newVar3Refs.references = Lists.newArrayList(newVar3In2Ref);
scriptMap.put(globalScope.getVar(VAR1), newVar1Refs);
scriptMap.put(globalScope.getVar(VAR2), newVar2Refs);
scriptMap.put(globalScope.getVar(VAR3), newVar3Refs);
map.updateGlobalVarReferences(scriptMap, scriptRoot);
ReferenceCollection refs = map.getReferences(globalScope.getVar(VAR1));
assertEquals(3, refs.references.size());
assertEquals(var1Refs.references.get(0), refs.references.get(0));
assertEquals(newVar1In2Ref, refs.references.get(1));
assertEquals(var1Refs.references.get(2), refs.references.get(2));
refs = map.getReferences(globalScope.getVar(VAR2));