Search in sources :

Example 1 with CommandEvent

use of com.facebook.buck.event.CommandEvent in project buck by facebook.

the class CommandEventTest method testEquals.

@Test
public void testEquals() throws Exception {
    CommandEvent.Started startedDaemon = configureTestEvent(CommandEvent.started("build", ImmutableList.of("sample-app"), true, 17L));
    CommandEvent.Started startedDaemonTwo = configureTestEvent(CommandEvent.started("build", ImmutableList.of("sample-app"), true, 23L));
    CommandEvent.Started startedNoDaemon = configureTestEvent(CommandEvent.started("build", ImmutableList.of("sample-app"), false, 3L));
    CommandEvent.Started startedDifferentName = configureTestEvent(CommandEvent.started("test", ImmutableList.of("sample-app"), false, 11L));
    CommandEvent finishedDaemon = configureTestEvent(CommandEvent.finished(startedDaemon, 0));
    CommandEvent finishedDaemonFailed = configureTestEvent(CommandEvent.finished(startedDaemonTwo, 1));
    CommandEvent finishedDifferentName = configureTestEvent(CommandEvent.finished(startedDifferentName, 0));
    assertNotEquals(startedDaemon, startedDaemonTwo);
    assertNotEquals(startedDaemon, startedNoDaemon);
    assertNotEquals(startedDaemon, startedDifferentName);
    assertNotEquals(finishedDaemon, startedDaemon);
    assertNotEquals(finishedDaemon, finishedDaemonFailed);
    assertNotEquals(finishedDaemon, finishedDifferentName);
    assertThat(startedDaemon.isRelatedTo(finishedDaemon), Matchers.is(true));
    assertThat(finishedDaemon.isRelatedTo(startedDaemon), Matchers.is(true));
    assertThat(startedDaemon.isRelatedTo(startedDaemonTwo), Matchers.is(false));
}
Also used : CommandEvent(com.facebook.buck.event.CommandEvent) Test(org.junit.Test)

Aggregations

CommandEvent (com.facebook.buck.event.CommandEvent)1 Test (org.junit.Test)1