@Test public void onPOSTRequestVoteReturn200WithResponseGivenServiceReturnsResponse() throws Exception { when(raftService.requestVote(Model.vote)).thenReturn(Model.voteResponse); RequestVoteResponse actual = client().target("/vote") .request() .post(Entity.entity(Model.vote, MediaType.APPLICATION_JSON_TYPE)) .readEntity(RequestVoteResponse.class); assertThat(actual).isEqualTo(Model.voteResponse); }
@Path("/vote") @POST public RequestVoteResponse requestVote(RequestVote vote) { return raft.requestVote(vote); }
BargeResource { @Path("/vote") @POST public RequestVoteResponse requestVote(RequestVote vote) { return raft.requestVote(vote); } }
BargeResource { @Path("/vote") @POST public RequestVoteResponse requestVote(RequestVote vote) { return raft.requestVote(vote); } @Inject  BargeResource(Raft raft, ClusterConfig clusterConfig); }
BargeResource { @Path("/vote") @POST public RequestVoteResponse requestVote(RequestVote vote) { return raft.requestVote(vote); } @Inject  BargeResource(Raft raft, ClusterConfig clusterConfig); @Path("/init") @POST Raft.StateType init(); @Path("/config") @GET ClusterConfig config(); @Path("/state") @GET Raft.StateType state(); @Path("/vote") @POST RequestVoteResponse requestVote(RequestVote vote); @Path("/entries") @POST AppendEntriesResponse appendEntries(AppendEntries appendEntries); @Path("/commit") @POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) Response commit(byte[] operation); }
BargeResource { @Path("/vote") @POST public RequestVoteResponse requestVote(RequestVote vote) { return raft.requestVote(vote); } @Inject  BargeResource(Raft raft, ClusterConfig clusterConfig); @Path("/init") @POST Raft.StateType init(); @Path("/config") @GET ClusterConfig config(); @Path("/state") @GET Raft.StateType state(); @Path("/vote") @POST RequestVoteResponse requestVote(RequestVote vote); @Path("/entries") @POST AppendEntriesResponse appendEntries(AppendEntries appendEntries); @Path("/commit") @POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) Response commit(byte[] operation);  }