### Question:
CloudFoundryPlatform extends Platform { @Override public ApiStatus getApiStatus () { try { cloudFoundryOperations.applications().list(); return ApiStatus.OK; } catch (RuntimeException e) { log.error("Failed to load application list", e); return ApiStatus.ERROR; } } @Autowired  CloudFoundryPlatform(); boolean isChaosEngine(String applicationName); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); @Override List<Container> generateRoster(); void restageApplication(RestageApplicationRequest restageApplicationRequest);  }### Answer:
@Test public void getApiStatusError () { when(cloudFoundryOperations.applications()).thenThrow(mock(RuntimeException.class)); assertEquals(ApiStatus.ERROR, cfp.getApiStatus()); }
@Test public void getApiStatusSuccess () { when(cloudFoundryOperations.applications()).thenReturn(applications); assertEquals(ApiStatus.OK, cfp.getApiStatus()); }