JvmService { @GET @Path("/dump/thread") @Produces(MediaType.TEXT_PLAIN) @ApiOperation("Get thread dump of jvm") @ApiResponses(@ApiResponse(code = 200, message = "The response contains thread dump")) @ApiResponse(code = 500, message = "Internal server error occurred") public StreamingOutput threadDump() { return manager::writeThreadDump; } @Inject  JvmService(JvmManager manager); @GET @Path("/dump/thread") @Produces(MediaType.TEXT_PLAIN) @ApiOperation("Get thread dump of jvm") @ApiResponses(@ApiResponse(code = 200, message = "The response contains thread dump")) @ApiResponse(code = 500, message = "Internal server error occurred") StreamingOutput threadDump(); @GET @Path("/dump/heap") @Produces("application/zip") @ApiOperation("Get heap dump of jvm") @ApiResponses(@ApiResponse(code = 200, message = "The response contains jvm heap dump")) @ApiResponse(code = 500, message = "Internal server error occurred") Response heapDump();  }
@Test public void testThreadDump() { final Response response = expect().statusCode(200).contentType(MediaType.TEXT_PLAIN).when().get("/jvm/dump/thread"); assertTrue(response.body().asString().contains("Dump of")); assertTrue(response.body().asString().contains("\"main\" prio=")); assertTrue(response.body().asString().contains("\"main\" prio=")); assertTrue(response.body().asString().contains("Non-daemon threads")); assertTrue(response.body().asString().contains("Blocked threads")); }