// Path: src/main/java/rx/marble/RecordedStreamComparator.java
// public enum EventComparisonResult { EQUALS, ONLY_ON_ACTUAL, ONLY_ON_EXPECTED }


import org.junit.Test;
import rx.Notification;
import java.util.ArrayList;
import java.util.List;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
import static rx.Notification.createOnError;
import static rx.Notification.createOnNext;
import static rx.marble.RecordedStreamComparator.EventComparisonResult.*;
package rx.marble;




/**
 * Created by Alexandre Victoor on 26/10/2016.
 */
public class RecordedStreamComparatorTest {


    @Test
    public void should_detect_missing_event_in_actual_records() {
        // given
        Recorded<?> onCompletedEvent = new Recorded<>(10, Notification.createOnCompleted());
        List<Recorded<?>> actualRecords = asList();
        List<Recorded<?>> expectedRecords = new ArrayList<>();
        expectedRecords.add(onCompletedEvent);

        // when
        RecordedStreamComparator.StreamComparison result
                = new RecordedStreamComparator().compare(actualRecords, expectedRecords);
        // then
        assertThat(result.streamEquals).isFalse();
        assertThat(result.unitComparisons).hasSize(1);
        assertThat(result.unitComparisons.get(0)).isEqualToComparingFieldByField(
// Path: src/main/java/rx/marble/RecordedStreamComparator.java
// public enum EventComparisonResult { EQUALS, ONLY_ON_ACTUAL, ONLY_ON_EXPECTED }


// Path: src/test/java/rx/marble/RecordedStreamComparatorTest.java
import org.junit.Test;
import rx.Notification;
import java.util.ArrayList;
import java.util.List;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
import static rx.Notification.createOnError;
import static rx.Notification.createOnNext;
import static rx.marble.RecordedStreamComparator.EventComparisonResult.*;

package rx.marble;




/**
 * Created by Alexandre Victoor on 26/10/2016.
 */
public class RecordedStreamComparatorTest {


    @Test
    public void should_detect_missing_event_in_actual_records() {
        // given
        Recorded<?> onCompletedEvent = new Recorded<>(10, Notification.createOnCompleted());
        List<Recorded<?>> actualRecords = asList();
        List<Recorded<?>> expectedRecords = new ArrayList<>();
        expectedRecords.add(onCompletedEvent);

        // when
        RecordedStreamComparator.StreamComparison result
                = new RecordedStreamComparator().compare(actualRecords, expectedRecords);
        // then
        assertThat(result.streamEquals).isFalse();
        assertThat(result.unitComparisons).hasSize(1);
        assertThat(result.unitComparisons.get(0)).isEqualToComparingFieldByField(
                new RecordedStreamComparator.EventComparison(onCompletedEvent, RecordedStreamComparator.EventComparisonResult.ONLY_ON_EXPECTED)