### Question:
HealthCheck extends Descriptor { public static HttpHealthCheck.Builder newHttpHealthCheck() { return HttpHealthCheck.newBuilder(); } HealthCheck(final String type); String getType(); static ExecHealthCheck.Builder newExecHealthCheck(); static HttpHealthCheck.Builder newHttpHealthCheck(); static TcpHealthCheck.Builder newTcpHealthCheck(); @Override String toString(); static final String EXEC; static final String HTTP; static final String TCP; }### Answer:
@Test public void testHttpHealthCheckBuilder() { final HttpHealthCheck.Builder builder = HealthCheck.newHttpHealthCheck(); final String setPort = "http-admin"; final String setPath = "/healthcheck"; builder.setPort(setPort); builder.setPath(setPath); assertEquals("port", setPort, builder.getPort()); assertEquals("path", setPath, builder.getPath()); final HttpHealthCheck healthCheck = builder.build(); assertEquals("port", setPort, healthCheck.getPort()); assertEquals("path", setPath, healthCheck.getPath()); }
@Test(expected = IllegalArgumentException.class) public void testHttpWithoutPort() { HealthCheck.newHttpHealthCheck().setPath("/healthcheck").build(); }
@Test(expected = IllegalArgumentException.class) public void testHttpWithoutPath() { HealthCheck.newHttpHealthCheck().setPort("http-admin").build(); }