@Test public void onPOSTAppendEntriesReturn200WithResponseGivenServiceReturnsResponse() throws Exception { when(raftService.appendEntries(Model.entries)).thenReturn(Model.entriesResponse); AppendEntriesResponse actual = client().target("/entries") .request() .post(Entity.entity(Model.entries, MediaType.APPLICATION_JSON_TYPE)) .readEntity(AppendEntriesResponse.class); assertThat(actual).isEqualTo(Model.entriesResponse); }
@Path("/entries") @POST public AppendEntriesResponse appendEntries(AppendEntries appendEntries) { return raft.appendEntries(appendEntries); }
BargeResource { @Path("/entries") @POST public AppendEntriesResponse appendEntries(AppendEntries appendEntries) { return raft.appendEntries(appendEntries); } }
BargeResource { @Path("/entries") @POST public AppendEntriesResponse appendEntries(AppendEntries appendEntries) { return raft.appendEntries(appendEntries); } @Inject  BargeResource(Raft raft, ClusterConfig clusterConfig); }
BargeResource { @Path("/entries") @POST public AppendEntriesResponse appendEntries(AppendEntries appendEntries) { return raft.appendEntries(appendEntries); } @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("/entries") @POST public AppendEntriesResponse appendEntries(AppendEntries appendEntries) { return raft.appendEntries(appendEntries); } @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);  }