package com.trello.navi;

import com.trello.navi.internal.NaviEmitter;
import org.junit.Test;

import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;

public class EventHandlingTest {
  @Test public void handlesEventsNone() {
    NaviComponent component = NaviEmitter.createActivityEmitter();
    assertTrue(component.handlesEvents());
  }

  @Test public void handlesEventsSingle() {
    NaviComponent component = NaviEmitter.createActivityEmitter();
    assertTrue(component.handlesEvents(Event.CREATE));
    assertFalse(component.handlesEvents(Event.CREATE_VIEW));
  }

  @Test public void handlesEventsMultiple() {
    NaviComponent component = NaviEmitter.createActivityEmitter();
    assertTrue(component.handlesEvents(Event.CREATE, Event.START, Event.RESUME));
    assertFalse(component.handlesEvents(Event.ATTACH, Event.CREATE_VIEW));
    assertFalse(component.handlesEvents(Event.CREATE, Event.CREATE_VIEW));
  }
}

@@ -186,16 +186,56 @@
 ertTrue;
+%0Aimport static org.mockito.Mockito.mock;
 %0A%0Apublic
@@ -998,11 +998,527 @@
 W));%0A  %7D
+%0A%0A  @Test(expected = IllegalArgumentException.class) public void throwOnRemoveUnsupportedListener()%0A      throws Exception %7B%0A    final NaviEmitter emitter = NaviEmitter.createActivityEmitter();%0A    emitter.removeListener(Event.DETACH, mock(Listener.class));%0A  %7D%0A%0A  @Test(expected = IllegalArgumentException.class) public void throwOnAddUnsupportedListener()%0A      throws Exception %7B%0A    final NaviEmitter emitter = NaviEmitter.createActivityEmitter();%0A    emitter.addListener(Event.DETACH, mock(Listener.class));%0A  %7D
 %0A%7D%0A

Add Tests for Exception when adding/removing a listener for an unsupported event