NomadEndpoint implements NomadServer<T> { @Override public AcceptRejectResponse commit(CommitMessage message) throws NomadException { return server.commit(message); } NomadEndpoint(InetSocketAddress address, NomadServer<T> server); InetSocketAddress getAddress(); @Override DiscoverResponse<T> discover(); @Override AcceptRejectResponse prepare(PrepareMessage message); @Override AcceptRejectResponse commit(CommitMessage message); @Override AcceptRejectResponse rollback(RollbackMessage message); @Override AcceptRejectResponse takeover(TakeoverMessage message); @Override void close(); @Override String toString();  }
@Test public void delegateCommit() throws Exception { when(server.commit(commitMessage)).thenReturn(acceptRejectResponse); NomadEndpoint<String> namedServer = new NomadEndpoint<>(name, server); assertEquals(acceptRejectResponse, namedServer.commit(commitMessage)); verify(server).commit(commitMessage); }