CassandraConfig { @POST @Path("/set_replaced_ip") public Response setReplacedIp(@QueryParam("ip") String ip) { if (StringUtils.isEmpty(ip)) return Response.status(Status.BAD_REQUEST).build(); try { priamServer.getInstanceIdentity().setReplacedIp(ip); return Response.ok().build(); } catch (Exception e) { logger.error("Error while overriding replacement ip", e); return Response.serverError().build(); } } @Inject  CassandraConfig(PriamServer server, DoubleRing doubleRing, CassMonitorMetrics metrics); @GET @Path("/get_seeds") Response getSeeds(); @GET @Path("/get_token") Response getToken(); @GET @Path("/is_replace_token") Response isReplaceToken(); @GET @Path("/get_replaced_ip") Response getReplacedIp(); @POST @Path("/set_replaced_ip") Response setReplacedIp(@QueryParam("ip") String ip); @GET @Path("/get_extra_env_params") Response getExtraEnvParams(); @GET @Path("/double_ring") Response doubleRing();  }
@Test public void setReplacedIp() { new Expectations() { { priamServer.getInstanceIdentity(); result = instanceIdentity; } }; Response response = resource.setReplacedIp("127.0.0.1"); assertEquals(200, response.getStatus()); assertEquals("127.0.0.1", instanceIdentity.getReplacedIp()); assertTrue(instanceIdentity.isReplace()); response = resource.setReplacedIp(null); assertEquals(400, response.getStatus()); }