DefaultScope implements Expression.Scope { @Override public Expression lookup(final Context c, final String name) { final Function<Context, Expression> variable = scope.get(name); if (variable == null) { throw c.scopeLookupError(name); } return variable.apply(c); } DefaultScope(final long now); @Override Expression lookup(final Context c, final String name);  }
@Test public void lookupTest() { assertEquals(new IntegerExpression(ctx, 42L), scope.lookup(ctx, Expression.NOW)); }
@Test(expected = ParseException.class) public void lookupMissingTest() { doReturn(new ParseException("", null, 0, 0, 0, 0)).when(ctx).scopeLookupError("missing"); scope.lookup(ctx, "missing"); }