void (Disposable parent) { final NamespaceContext old = ContextProvider.DefaultProvider.NULL_NAMESPACE_CONTEXT; ContextProvider.DefaultProvider.NULL_NAMESPACE_CONTEXT = TestNamespaceContext.INSTANCE; Disposer.register(parent, new Disposable() { @Override public void dispose() { ContextProvider.DefaultProvider.NULL_NAMESPACE_CONTEXT = old; } }); }