### Question:
CoapProtocolServer implements ProtocolServer { @Override public CompletableFuture<Void> destroy(ExposedThing thing) { if (server == null) { return completedFuture(null); } log.info("CoapServer on '{}' port '{}' stop exposing '{}' at coap: thing.getId(), bindHost, actualPort, thing.getId()); things.remove(thing.getId()); CoapResource resource = resources.remove(thing.getId()); if (resource != null) { server.getRoot().delete(resource); } return completedFuture(null); } CoapProtocolServer(Config config); @SuppressWarnings({ "java:S107" })  CoapProtocolServer(String bindHost,
                       int bindPort,
                       List<String> addresses,
                       Map<String, ExposedThing> things,
                       Map<String, CoapResource> resources,
                       Supplier<WotCoapServer> serverSupplier,
                       WotCoapServer server,
                       int actualPort,
                       List<String> actualAddresses); @Override String toString(); @Override CompletableFuture<Void> start(Servient servient); @Override CompletableFuture<Void> stop(); @Override CompletableFuture<Void> expose(ExposedThing thing); @Override CompletableFuture<Void> destroy(ExposedThing thing); @Override URI getDirectoryUrl(); @Override URI getThingUrl(String id); int getBindPort(); Map<String, ExposedThing> getThings();  }### Answer:
@Test public void destroyShouldRemoveThingResource() { when(resources.remove(any())).thenReturn(resource); when(coapServer.getRoot()).thenReturn(resource); CoapProtocolServer server = new CoapProtocolServer(bindHost, bindPort, addresses, things, resources, serverSupplier, coapServer, bindPort, addresses); server.destroy(thing); verify(resource, timeout(1 * 1000L)).delete(resource); }