EcmaScriptDataModel implements DataModel { @Override public int deleteScope() { if (topmostScope == null) { return ERROR_SCOPE_NOT_FOUND; } final Scope scope = scopes.get(topmostScope); if (scope == null) { return ERROR_SCOPE_NOT_FOUND; } return deleteScope(scope); } EcmaScriptDataModel(); @Override DataModel newInstance(); @Override Object getUndefinedValue(); @Override Object createNewObject(); @Override int createScope(final Scope scope); @Override int copyValues(final DataModel model); @Override int createScope(); @Override int deleteScope(); @Override int deleteScope(final Scope scope); @Override int createVariable(final String variableName); @Override int createVariable(final String variableName, final Object value); @Override int createVariable(final String variableName, final Object value,
            final Scope scope); @Override int createVariableFor(final Object variable,
            final String variableName); @Override int createVariableFor(Object variable, final String variableName,
            final Object value); @Override int createArray(String arrayName, int dimension); @Override int createArray(final String arrayName, final int dimension,
            final Scope scope); @Override int resizeArray(final String arrayName, final int dimension); @Override int resizeArray(final String arrayName, final int dimension,
            final Scope scope); @Override boolean existsVariable(final String variableName); @Override boolean existsVariable(final String variableName, final Scope scope); boolean existsVariable(final String variableName, final Scope scope,
            final Scriptable start); @Override int deleteVariable(final String variableName); @Override int deleteVariable(final String variableName, final Scope scope); @Override int updateVariable(final String variableName, final Object newValue); @Override int updateVariable(final String variableName, final Object newValue,
            final Scope scope); @Override int updateVariableFor(final Object variable,
            final String variableName, final Object newValue); @Override int updateArray(final String variableName, final int position,
            final Object newValue); @Override int updateArray(final String variableName, final int position,
            final Object newValue, final Scope scope); @Override T readVariable(final String variableName,
            final Class<T> type); @Override T readVariable(String variableName, Scope scope,
            final Class<T> type); @Override T readArray(final String arrayName, final int position,
            final Class<T> type); @Override T readArray(final String arrayName, final int position,
            final Scope scope, final Class<T> type); @Override T evaluateExpression(final String expr,
            final Class<T> type); @Override T evaluateExpression(final String expr,
            final Scope scope, final Class<T> type); @Override String toString(final Object object); static String toJSON(final Scriptable object); void setSerializer(final DataModelObjectSerializer value); @Override DataModelObjectSerializer getSerializer();  }
@Test public void testDeleteScope() { final DataModel data = new EcmaScriptDataModel(); Assert.assertEquals(DataModel.NO_ERROR, data.createScope()); Assert.assertEquals(DataModel.NO_ERROR, data.createScope()); Assert.assertEquals(DataModel.NO_ERROR, data.deleteScope()); Assert.assertEquals(DataModel.NO_ERROR, data.deleteScope()); Assert.assertEquals(DataModel.ERROR_SCOPE_NOT_FOUND, data.deleteScope()); }