MvcGraph { public <T> T reference(Class<T> type, Annotation qualifier) throws ProviderMissingException, ProvideException, CircularDependenciesException { if (!uiThreadRunner.isOnUiThread()) { throw new MvcGraphException("Cannot reference an instance from Non-UiThread"); } return graph.reference(type, qualifier, Inject.class); }  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(expected = MvcGraphException.class) public void should_throw_exception_when_mvc_graph_reference_on_non_main_thread() throws ProvideException, CircularDependenciesException, ProviderMissingException { graph.reference(String.class, null); when(graph.uiThreadRunner.isOnUiThread()).thenReturn(false); graph.reference(String.class, null); }