Search in sources :

Example 1 with MockTreeModelListener

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

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuildEndThenFail.

@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuildEndThenFail() {
    DefaultTreeModel treeModel = new DefaultTreeModel(null);
    BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
    MockTreeModelListener listener = addListeners(treeModel);
    buckEventsConsumer.attach(null, treeModel);
    assertFalse(listener.calledOnWrongThread);
    assertTrue(buckEventsConsumer.isAttached());
    buckEventsConsumer.consumeBuildEnd(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 2 with MockTreeModelListener

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

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeParseRuleEndThenFail.

@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeParseRuleEndThenFail() {
    DefaultTreeModel treeModel = new DefaultTreeModel(null);
    BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
    MockTreeModelListener listener = addListeners(treeModel);
    buckEventsConsumer.attach(null, treeModel);
    assertFalse(listener.calledOnWrongThread);
    assertTrue(buckEventsConsumer.isAttached());
    buckEventsConsumer.consumeParseRuleEnd(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 3 with MockTreeModelListener

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

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeParseRuleStartThenFail.

@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeParseRuleStartThenFail() {
    DefaultTreeModel treeModel = new DefaultTreeModel(null);
    BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
    MockTreeModelListener listener = addListeners(treeModel);
    buckEventsConsumer.attach(null, treeModel);
    assertFalse(listener.calledOnWrongThread);
    assertTrue(buckEventsConsumer.isAttached());
    buckEventsConsumer.consumeParseRuleStart(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 4 with MockTreeModelListener

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

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeCompilerErrorThenFail.

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

Example 5 with MockTreeModelListener

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

the class BuckEventsConsumerTest method addListeners.

public MockTreeModelListener addListeners(DefaultTreeModel treeModel) {
    final MockTreeModelListener listener = new MockTreeModelListener();
    // We need at least 2 listeners
    treeModel.addTreeModelListener(listener);
    treeModel.addTreeModelListener(new MockTreeModelListener());
    treeModel.addTreeModelListener(new MockTreeModelListener());
    return listener;
}
Also used : MockTreeModelListener(com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener)

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