ArchiveLogMessagesMethod { public Method methodDefinition() { return method; } ArchiveLogMessagesMethod(LogDispatcher logDispatcher); Method methodDefinition();  }
@Test public void server_dispatches_log_messages_from_log_request() { List<LogMessage> messages = List.of(MESSAGE_1, MESSAGE_2); LogDispatcher logDispatcher = mock(LogDispatcher.class); try (RpcServer server = new RpcServer(0)) { server.addMethod(new ArchiveLogMessagesMethod(logDispatcher).methodDefinition()); server.start(); try (TestClient client = new TestClient(server.listenPort())) { client.logMessages(messages); } } verify(logDispatcher).handle(new ArrayList<>(messages)); verify(logDispatcher).flush(); }