@Test public void removeSpyEventHandler_noExists() { final SpyImpl support = new SpyImpl(); final SpyEventHandler handler = new TestSpyEventHandler(); final IllegalStateException exception = expectThrows( IllegalStateException.class, () -> support.removeSpyEventHandler( handler ) ); assertEquals( exception.getMessage(), "Replicant-0039: Attempting to remove handler " + handler + " that is not in the list of spy handlers." ); }
@Override public void removeSpyEventHandler( @Nonnull final SpyEventHandler handler ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> _spyEventHandlers.contains( handler ), () -> "Replicant-0039: Attempting to remove handler " + handler + " that is not " + "in the list of spy handlers." ); } _spyEventHandlers.remove( Objects.requireNonNull( handler ) ); }
SpyImpl implements Spy { @Override public void removeSpyEventHandler( @Nonnull final SpyEventHandler handler ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> _spyEventHandlers.contains( handler ), () -> "Replicant-0039: Attempting to remove handler " + handler + " that is not " + "in the list of spy handlers." ); } _spyEventHandlers.remove( Objects.requireNonNull( handler ) ); } }
SpyImpl implements Spy { @Override public void removeSpyEventHandler( @Nonnull final SpyEventHandler handler ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> _spyEventHandlers.contains( handler ), () -> "Replicant-0039: Attempting to remove handler " + handler + " that is not " + "in the list of spy handlers." ); } _spyEventHandlers.remove( Objects.requireNonNull( handler ) ); }  }
SpyImpl implements Spy { @Override public void removeSpyEventHandler( @Nonnull final SpyEventHandler handler ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> _spyEventHandlers.contains( handler ), () -> "Replicant-0039: Attempting to remove handler " + handler + " that is not " + "in the list of spy handlers." ); } _spyEventHandlers.remove( Objects.requireNonNull( handler ) ); }  @Override void addSpyEventHandler( @Nonnull final SpyEventHandler handler ); @Override void removeSpyEventHandler( @Nonnull final SpyEventHandler handler ); @Override void reportSpyEvent( @Nonnull final Object event ); @Override boolean willPropagateSpyEvents(); }
SpyImpl implements Spy { @Override public void removeSpyEventHandler( @Nonnull final SpyEventHandler handler ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> _spyEventHandlers.contains( handler ), () -> "Replicant-0039: Attempting to remove handler " + handler + " that is not " + "in the list of spy handlers." ); } _spyEventHandlers.remove( Objects.requireNonNull( handler ) ); }  @Override void addSpyEventHandler( @Nonnull final SpyEventHandler handler ); @Override void removeSpyEventHandler( @Nonnull final SpyEventHandler handler ); @Override void reportSpyEvent( @Nonnull final Object event ); @Override boolean willPropagateSpyEvents();  }