### Question:
CloudFoundryContainerPlatform extends CloudFoundryPlatform implements SshBasedExperiment<CloudFoundryContainer> { String getSSHOneTimePassword () { log.debug("Requesting a one-time SSH password for {}", v(DataDogConstants.DATADOG_PLATFORM_KEY, this)); return cloudFoundryOperations.advanced().sshCode().blockOptional().orElseThrow(EMPTY_RESPONSE.asChaosException()); } @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 getOneTimePassword () { String sshCode = randomUUID().toString(); Advanced advanced = mock(Advanced.class); doReturn(advanced).when(cloudFoundryOperations).advanced(); doReturn(Mono.just(sshCode)).when(advanced).sshCode(); assertEquals(sshCode, cloudFoundryContainerPlatform.getSSHOneTimePassword()); }
@Test(expected = ChaosException.class) public void getOneTimePasswordException () { Advanced advanced = mock(Advanced.class); doReturn(advanced).when(cloudFoundryOperations).advanced(); doReturn(Mono.empty()).when(advanced).sshCode(); cloudFoundryContainerPlatform.getSSHOneTimePassword(); }