@Test
  public void unregisterListeners() {
    AbstractSignalNotificationHandler signalHandler = createSignalNotificationHandler();

    SignalListener mockSigQuitListener = mock(SignalListener.class, "SIGQUIT");
    SignalListener mockSigTermListener = mock(SignalListener.class, "SIGTERM");
    SignalListener mockSigTermQuitListener = mock(SignalListener.class, "SIGTERM + SIGQUIT");

    assertThat(signalHandler.isListening(mockSigQuitListener)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermListener)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermQuitListener)).isFalse();

    for (Signal signal : Signal.values()) {
      assertThat(signalHandler.hasListeners(signal)).isFalse();
    }

    // register sigquit and sigterm listeners...
    assertThat(signalHandler.registerListener(mockSigQuitListener, Signal.SIGQUIT)).isTrue();
    assertThat(signalHandler.registerListener(mockSigTermListener, Signal.SIGTERM)).isTrue();
    assertThat(signalHandler.registerListener(mockSigTermQuitListener, Signal.SIGQUIT)).isTrue();
    assertThat(signalHandler.registerListener(mockSigTermQuitListener, Signal.SIGTERM)).isTrue();

    assertThat(signalHandler.isListening(mockSigQuitListener)).isTrue();
    assertThat(signalHandler.isListening(mockSigQuitListener, Signal.SIGINT)).isFalse();
    assertThat(signalHandler.isListening(mockSigQuitListener, Signal.SIGQUIT)).isTrue();
    assertThat(signalHandler.isListening(mockSigQuitListener, Signal.SIGTERM)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermListener)).isTrue();
    assertThat(signalHandler.isListening(mockSigTermListener, Signal.SIGINT)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermListener, Signal.SIGQUIT)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermListener, Signal.SIGTERM)).isTrue();
    assertThat(signalHandler.isListening(mockSigTermQuitListener)).isTrue();
    assertThat(signalHandler.isListening(mockSigTermQuitListener, Signal.SIGINT)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermQuitListener, Signal.SIGQUIT)).isTrue();
    assertThat(signalHandler.isListening(mockSigTermQuitListener, Signal.SIGTERM)).isTrue();
    assertThat(signalHandler.hasListeners(Signal.SIGINT)).isFalse();
    assertThat(signalHandler.hasListeners(Signal.SIGQUIT)).isTrue();
    assertThat(signalHandler.hasListeners(Signal.SIGTERM)).isTrue();

    // unregister all sigterm listeners...
    assertThat(signalHandler.unregisterListeners(Signal.SIGTERM)).isTrue();

    assertThat(signalHandler.isListening(mockSigQuitListener)).isTrue();
    assertThat(signalHandler.isListening(mockSigQuitListener, Signal.SIGINT)).isFalse();
    assertThat(signalHandler.isListening(mockSigQuitListener, Signal.SIGQUIT)).isTrue();
    assertThat(signalHandler.isListening(mockSigQuitListener, Signal.SIGTERM)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermListener)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermListener, Signal.SIGINT)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermListener, Signal.SIGQUIT)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermListener, Signal.SIGTERM)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermQuitListener)).isTrue();
    assertThat(signalHandler.isListening(mockSigTermQuitListener, Signal.SIGINT)).isFalse();
    assertThat(signalHandler.isListening(mockSigTermQuitListener, Signal.SIGQUIT)).isTrue();
    assertThat(signalHandler.isListening(mockSigTermQuitListener, Signal.SIGTERM)).isFalse();
    assertThat(signalHandler.hasListeners(Signal.SIGINT)).isFalse();
    assertThat(signalHandler.hasListeners(Signal.SIGQUIT)).isTrue();
    assertThat(signalHandler.hasListeners(Signal.SIGTERM)).isFalse();
  }
Unit tests for {@link AbstractSignalNotificationHandler}.

@since GemFire 7.0
geode-core/src/test/java/org/apache/geode/internal/process/signal/AbstractSignalNotificationHandlerTest.java