@Test
public void testGetConsoleAsScriptable() throws Exception {
final Global globalScope = new Global();
final WrappingConsoleProvider wrappingConsoleFactory =
new WrappingConsoleProvider(new SystemOutConsole());
ContextFactory contextFactory = new ContextFactory();
contextFactory.call(new ContextAction() {
@Override
public Object run(Context cx) {
cx.initStandardObjects(globalScope);
Scriptable consoleAsScriptable = wrappingConsoleFactory.getConsoleAsScriptable(globalScope);
Function log = ScriptableObject.getTypedProperty(consoleAsScriptable, "log", Function.class);
Function apply = ScriptableObject.getTypedProperty(log, "apply", Function.class);
assertFalse(Scriptable.NOT_FOUND.equals(apply));