@Test public void should_throw_exception_when_mvc_graph_register_monitor_on_non_main_thread() throws Graph.IllegalRootComponentException { when(graph.uiThreadRunner.isOnUiThread()).thenReturn(false); graph.registerMonitor(mock(Graph.Monitor.class)); when(graph.uiThreadRunner.isOnUiThread()).thenReturn(true); graph.registerMonitor(mock(Graph.Monitor.class)); }
graph.registerMonitor(monitor);