Search in sources :

Example 16 with MockTreeModelListener

use of com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener in project buck by facebook.

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuckProjectGenerationStartedThenFail.

@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuckProjectGenerationStartedThenFail() {
    DefaultTreeModel treeModel = new DefaultTreeModel(null);
    BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
    MockTreeModelListener listener = addListeners(treeModel);
    buckEventsConsumer.attach(null, treeModel);
    assertFalse(listener.calledOnWrongThread);
    assertTrue(buckEventsConsumer.isAttached());
    buckEventsConsumer.consumeBuckProjectGenerationStarted(0);
    assertFalse(listener.calledOnWrongThread);
}
Also used : MockTreeModelListener(com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Test(org.junit.Test)

Example 17 with MockTreeModelListener

use of com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener in project buck by facebook.

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeTestResultsAvailableThenFail.

@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeTestResultsAvailableThenFail() {
    DefaultTreeModel treeModel = new DefaultTreeModel(null);
    BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
    MockTreeModelListener listener = addListeners(treeModel);
    buckEventsConsumer.attach(null, treeModel);
    assertFalse(listener.calledOnWrongThread);
    assertTrue(buckEventsConsumer.isAttached());
    buckEventsConsumer.consumeTestResultsAvailable(0, new MockTestResults());
    assertFalse(listener.calledOnWrongThread);
    buckEventsConsumer.consumeTestResultsAvailable(1, new MockTestResults());
    assertFalse(listener.calledOnWrongThread);
}
Also used : MockTreeModelListener(com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener) MockTestResults(com.facebook.buck.intellij.ideabuck.test.util.MockTestResults) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Test(org.junit.Test)

Aggregations

MockTreeModelListener (com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener)17 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)16 Test (org.junit.Test)16 MockTestResults (com.facebook.buck.intellij.ideabuck.test.util.MockTestResults)1