### Question:
CloudFoundryContainerPlatform extends CloudFoundryPlatform implements SshBasedExperiment<CloudFoundryContainer> { @Override public String getEndpoint (CloudFoundryContainer container) { log.debug("Retrieving SSH Endpoint for {}", v(DataDogConstants.DATADOG_PLATFORM_KEY, this)); return cloudFoundryClient.info() .get(GetInfoRequest.builder().build()) .blockOptional().orElseThrow(EMPTY_RESPONSE.asChaosException()) .getApplicationSshEndpoint(); } @Autowired  CloudFoundryContainerPlatform(); @Override boolean isContainerRecycled(Container container); ContainerHealth checkHealth(String applicationId, Integer instanceId); @Override List<Container> generateRoster(); void restartInstance(RestartApplicationInstanceRequest restartApplicationInstanceRequest); @Override String getEndpoint(CloudFoundryContainer container); @Override SSHCredentials getSshCredentials(CloudFoundryContainer container); @Override void recycleContainer(CloudFoundryContainer container);  }### Answer:
@Test public void getEndpoint () { Info info = mock(Info.class); String expectedEndpoint = UUID.randomUUID().toString(); GetInfoResponse infoResponse = GetInfoResponse.builder().applicationSshEndpoint(expectedEndpoint).build(); doReturn(Mono.just(infoResponse)).when(info).get(any()); doReturn(info).when(cloudFoundryClient).info(); assertEquals(expectedEndpoint, cloudFoundryContainerPlatform.getEndpoint(null)); }
@Test(expected = ChaosException.class) public void getEndpointException () { Info info = mock(Info.class); String expectedEndpoint = UUID.randomUUID().toString(); doReturn(Mono.empty()).when(info).get(any()); doReturn(info).when(cloudFoundryClient).info(); assertEquals(expectedEndpoint, cloudFoundryContainerPlatform.getEndpoint(null)); }