MvcGraph { public void unregisterMonitor(final Graph.Monitor monitor) { if (uiThreadRunner.isOnUiThread()) { graph.unregisterMonitor(monitor); } else { uiThreadRunner.post(new Runnable() { @Override public void run() { graph.unregisterMonitor(monitor); } }); } }  void registerMonitor(final Graph.Monitor monitor); void unregisterMonitor(final Graph.Monitor monitor); void clearMonitors(); T reference(Class<T> type, Annotation qualifier); void dereference(T instance, Class<T> type, Annotation qualifier); void use(final Class<T> type, final Consumer<T> consumer); void use(final Class<T> type, final Annotation qualifier, final Consumer<T> consumer); void inject(final Object target); void release(final Object target); void setRootComponent(final MvcComponent component); MvcComponent getRootComponent(); void registerDereferencedListener(
            final Provider.DereferenceListener onProviderFreedListener); void unregisterDereferencedListener(
            final Provider.DereferenceListener onProviderFreedListener); void clearDereferencedListeners();  }
@Test public void should_throw_exception_when_mvc_graph_unregister_monitor_on_non_main_thread() throws Graph.IllegalRootComponentException { when(graph.uiThreadRunner.isOnUiThread()).thenReturn(false); graph.unregisterMonitor(mock(Graph.Monitor.class)); when(graph.uiThreadRunner.isOnUiThread()).thenReturn(true); graph.unregisterMonitor(mock(Graph.Monitor.class)); }