@Test public void test_start_application_should_fail() throws CloudFoundryException { ApplicationsV2 applications = mock(ApplicationsV2.class); when(cfClient.applicationsV2()).thenReturn(applications); mockGetApplication(applications, "name", "STOPPED"); when(cfClient.applicationsV2() .update( any(UpdateApplicationRequest.class))) .thenReturn(Mono.error(new RuntimeException("some error"))); verifyThrown(() -> cloudFoundryApi.startApplication("application-id"), CloudFoundryException.class); }
@Override public boolean startApplication(String applicationUuid) throws CloudFoundryException { log.debug("startApplication"); return changeApplicationState(applicationUuid, CloudFoundryAppState.STARTED); }
CloudFoundryApi implements CloudFoundryApiService { @Override public boolean startApplication(String applicationUuid) throws CloudFoundryException { log.debug("startApplication"); return changeApplicationState(applicationUuid, CloudFoundryAppState.STARTED); } }
CloudFoundryApi implements CloudFoundryApiService { @Override public boolean startApplication(String applicationUuid) throws CloudFoundryException { log.debug("startApplication"); return changeApplicationState(applicationUuid, CloudFoundryAppState.STARTED); }  }
CloudFoundryApi implements CloudFoundryApiService { @Override public boolean startApplication(String applicationUuid) throws CloudFoundryException { log.debug("startApplication"); return changeApplicationState(applicationUuid, CloudFoundryAppState.STARTED); }  @Override void bindApplications(String serviceInstanceId, List<ApplicationIdentity> applications); void bindRoutes(String serviceInstanceId, List<String> routeIds); @Override ApplicationActivity getApplicationActivity(String appUid); Instant getInstantFromLogMessageTimestamp(Long logMessageTimestamp); @Override String getApplicationState(String applicationUuid); @Override String getHost(String routeId); @Override boolean isAppRunning(String appUid); @Override List<ApplicationIdentity> listAliveApplications(String spaceUuid, Pattern excludeNames); @Override List<String> listApplicationRoutes(String applicationUuid); @Override List<String> listRouteApplications(String routeUuid); @Override boolean startApplication(String applicationUuid); @Override boolean stopApplication(String applicationUuid); @Override void unbind(String bindingId); boolean isValidOrganization(String organizationGuid); }
CloudFoundryApi implements CloudFoundryApiService { @Override public boolean startApplication(String applicationUuid) throws CloudFoundryException { log.debug("startApplication"); return changeApplicationState(applicationUuid, CloudFoundryAppState.STARTED); }  @Override void bindApplications(String serviceInstanceId, List<ApplicationIdentity> applications); void bindRoutes(String serviceInstanceId, List<String> routeIds); @Override ApplicationActivity getApplicationActivity(String appUid); Instant getInstantFromLogMessageTimestamp(Long logMessageTimestamp); @Override String getApplicationState(String applicationUuid); @Override String getHost(String routeId); @Override boolean isAppRunning(String appUid); @Override List<ApplicationIdentity> listAliveApplications(String spaceUuid, Pattern excludeNames); @Override List<String> listApplicationRoutes(String applicationUuid); @Override List<String> listRouteApplications(String routeUuid); @Override boolean startApplication(String applicationUuid); @Override boolean stopApplication(String applicationUuid); @Override void unbind(String bindingId); boolean isValidOrganization(String organizationGuid);  }