### Question:
NetworkWatcherService { public void removeWatch(Endpoint endpoint) { log.debug("Watcher service receive REMOVE-watch request for {}", endpoint); carrier.clearDiscovery(endpoint); discoveryPackets.removeIf(packet -> packet.endpoint.equals(endpoint)); roundTripPackets.removeIf(packet -> packet.endpoint.equals(endpoint)); confirmedPackets.removeIf(packet -> packet.endpoint.equals(endpoint)); lastSeenRoundTrip.remove(endpoint); } NetworkWatcherService(
            IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime, Integer taskId); @VisibleForTesting  NetworkWatcherService(
            Clock clock, IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime,
            Integer taskId); void addWatch(Endpoint endpoint); void removeWatch(Endpoint endpoint); void tick(); void confirmation(Endpoint endpoint, long packetNo); void discovery(IslInfoData discoveryEvent); void roundTripDiscovery(Endpoint endpoint, long packetId);  }### Answer:
@Test public void removeWatch() { NetworkWatcherService w = makeService(); w.addWatch(Endpoint.of(new SwitchId(1), 1), 1); w.addWatch(Endpoint.of(new SwitchId(1), 2), 2); w.addWatch(Endpoint.of(new SwitchId(2), 1), 3); w.addWatch(Endpoint.of(new SwitchId(2), 2), 4); w.addWatch(Endpoint.of(new SwitchId(3), 1), 5); verify(carrier, times(5)).sendDiscovery(any(DiscoverIslCommandData.class)); w.confirmation(Endpoint.of(new SwitchId(1), 2), 1); w.confirmation(Endpoint.of(new SwitchId(2), 1), 2); assertThat(w.getConfirmedPackets().size(), is(2)); assertThat(w.getTimeouts().size(), is(5)); assertThat(w.getDiscoveryPackets().size(), is(3)); w.removeWatch(Endpoint.of(new SwitchId(1), 2)); w.removeWatch(Endpoint.of(new SwitchId(2), 2)); verify(carrier).clearDiscovery(Endpoint.of(new SwitchId(1), 2)); verify(carrier).clearDiscovery(Endpoint.of(new SwitchId(2), 2)); assertThat(w.getConfirmedPackets().size(), is(1)); assertThat(w.getDiscoveryPackets().size(), is(2)); w.tick(100); assertThat(w.getTimeouts().size(), is(0)); }