Source:
<code>public void testExec() throws Exception { <START> assumeThat(isCircleCi(), Matchers.is(false)); <END> final DockerClient dockerClient = getNewDockerClient(); assumeThat(dockerClient.version(), is(execCompatibleDockerVersion())); startDefaultMaster(); final HeliosClient client = defaultClient(); startDefaultAgent(testHost(), "--service-registry=" + registryAddress); awaitHostStatus(client, testHost(), UP, LONG_WAIT_SECONDS, SECONDS); final HealthCheck healthCheck = ExecHealthCheck.of("test", "-e", "file"); final String portName = "service"; final String serviceName = "foo_service"; final String serviceProtocol = "foo_proto"; final Job job = Job.newBuilder() .setName(testJobName) .setVersion(testJobVersion) .setImage(BUSYBOX) .setCommand(asList("sh", "-c", "nc -l -p 4711")) .addPort(portName, PortMapping.of(4711)) .addRegistration(ServiceEndpoint.of(serviceName, serviceProtocol), ServicePorts.of(portName)) .setHealthCheck(healthCheck) .build(); final JobId jobId = createJob(job); deployJob(jobId, testHost()); final TaskStatus jobState = awaitTaskState(jobId, testHost(), HEALTHCHECKING); Thread.sleep(3000); verify(registrar, never()).register(any(ServiceRegistration.class)); final String[] makeFileCmd = new String[]{"touch", "file"}; final String execId = dockerClient.execCreate(jobState.getContainerId(), makeFileCmd); dockerClient.execStart(execId); awaitTaskState(jobId, testHost(), RUNNING); dockerClient.close(); verify(registrar, timeout((int) SECONDS.toMillis(LONG_WAIT_SECONDS))) .register(registrationCaptor.capture()); final ServiceRegistration serviceRegistration = registrationCaptor.getValue(); assertEquals(1, serviceRegistration.getEndpoints().size()); final Endpoint registeredEndpoint = serviceRegistration.getEndpoints().get(0); assertEquals("wrong service", serviceName, registeredEndpoint.getName()); assertEquals("wrong protocol", serviceProtocol, registeredEndpoint.getProtocol()); }</code><technical_language>option: assumeFalse() if more concise</technical_language>

Target:
public void testExec() throws Exception { assumeFalse(isCircleCi()); final DockerClient dockerClient = getNewDockerClient(); assumeThat(dockerClient.version(), is(execCompatibleDockerVersion())); startDefaultMaster(); final HeliosClient client = defaultClient(); startDefaultAgent(testHost(), "--service-registry=" + registryAddress); awaitHostStatus(client, testHost(), UP, LONG_WAIT_SECONDS, SECONDS); final HealthCheck healthCheck = ExecHealthCheck.of("test", "-e", "file"); final String portName = "service"; final String serviceName = "foo_service"; final String serviceProtocol = "foo_proto"; final Job job = Job.newBuilder() .setName(testJobName) .setVersion(testJobVersion) .setImage(BUSYBOX) .setCommand(asList("sh", "-c", "nc -l -p 4711")) .addPort(portName, PortMapping.of(4711)) .addRegistration(ServiceEndpoint.of(serviceName, serviceProtocol), ServicePorts.of(portName)) .setHealthCheck(healthCheck) .build(); final JobId jobId = createJob(job); deployJob(jobId, testHost()); final TaskStatus jobState = awaitTaskState(jobId, testHost(), HEALTHCHECKING); Thread.sleep(3000); verify(registrar, never()).register(any(ServiceRegistration.class)); final String[] makeFileCmd = new String[]{"touch", "file"}; final ExecCreation execCreation = dockerClient.execCreate( jobState.getContainerId(), makeFileCmd); final String execId = execCreation.id(); dockerClient.execStart(execId); awaitTaskState(jobId, testHost(), RUNNING); dockerClient.close(); verify(registrar, timeout((int) SECONDS.toMillis(LONG_WAIT_SECONDS))) .register(registrationCaptor.capture()); final ServiceRegistration serviceRegistration = registrationCaptor.getValue(); assertEquals(1, serviceRegistration.getEndpoints().size()); final Endpoint registeredEndpoint = serviceRegistration.getEndpoints().get(0); assertEquals("wrong service", serviceName, registeredEndpoint.getName()); assertEquals("wrong protocol", serviceProtocol, registeredEndpoint.getProtocol()); }