InjectionPoint implements IInjectionPoint { @Override public final Scope scopeAtInjectionPoint() { return scope; } InjectionPoint(FunctionDefinition enclosingFunction, boolean inLoop,
      boolean inSwitch,
      Scope scope); @Override final FunctionDefinition getEnclosingFunction(); @Override final boolean inLoop(); @Override final boolean inSwitch(); @Override final Scope scopeAtInjectionPoint();  }
@Test public void testScopeAtInjectionPoint() { final Scope scope = new Scope(); assertNotNull( new InjectionPoint(null, false, false, scope) { @Override public void inject(Stmt stmt) { throw new RuntimeException(); } @Override public Stmt getNextStmt() { throw new RuntimeException(); } @Override public boolean hasNextStmt() { throw new RuntimeException(); } @Override public void replaceNext(Stmt stmt) { throw new RuntimeException(); } }.scopeAtInjectionPoint()); }
@Test public void testThatScopeIsCloned() { Scope s = new Scope(); s.add("v", BasicType.INT, Optional.empty()); IInjectionPoint injectionPoint = new InjectionPoint(null, false, false, s) { @Override public void inject(Stmt stmt) { throw new RuntimeException(); } @Override public Stmt getNextStmt() { throw new RuntimeException(); } @Override public boolean hasNextStmt() { throw new RuntimeException(); } @Override public void replaceNext(Stmt stmt) { throw new RuntimeException(); } }; s.add("w", BasicType.INT, Optional.empty()); assertNull(injectionPoint.scopeAtInjectionPoint().lookupType("w")); }