private Mono<String> startApplication(String applicationId) {
   return this.cloudFoundryClient
       .applicationsV2()
       .update(
           UpdateApplicationRequest.builder()
               .applicationId(applicationId)
               .state("STARTED")
               .build())
       .map(ResourceUtils::getId)
       .then(this::waitForStaging)
       .then(this::waitForStarting);
 }
 private static Mono<AbstractApplicationResource> requestUpdateApplicationState(
     CloudFoundryClient cloudFoundryClient, String applicationId, String state) {
   return cloudFoundryClient
       .applicationsV2()
       .update(
           UpdateApplicationRequest.builder().applicationId(applicationId).state(state).build())
       .map(
           new Function<UpdateApplicationResponse, AbstractApplicationResource>() {
             @Override
             public AbstractApplicationResource apply(UpdateApplicationResponse x) {
               return x;
             }
           });
 }
 @Test
 public void update() {
   this.applicationId
       .then(
           applicationId ->
               this.cloudFoundryClient
                   .applicationsV2()
                   .update(
                       UpdateApplicationRequest.builder()
                           .applicationId(applicationId)
                           .name("another-test-application-name")
                           .build())
                   .map(ResourceUtils::getId))
       .then(
           applicationId ->
               this.cloudFoundryClient
                   .applicationsV2()
                   .get(GetApplicationRequest.builder().applicationId(applicationId).build())
                   .map(response -> response.getEntity().getName()))
       .subscribe(testSubscriber().assertEquals("another-test-application-name"));
 }
 private static Mono<AbstractApplicationResource> requestUpdateApplicationScale(
     CloudFoundryClient cloudFoundryClient,
     String applicationId,
     Integer disk,
     Integer instances,
     Integer memory) {
   return cloudFoundryClient
       .applicationsV2()
       .update(
           UpdateApplicationRequest.builder()
               .applicationId(applicationId)
               .diskQuota(disk)
               .instances(instances)
               .memory(memory)
               .build())
       .map(
           new Function<UpdateApplicationResponse, AbstractApplicationResource>() {
             @Override
             public AbstractApplicationResource apply(UpdateApplicationResponse x) {
               return x;
             }
           });
 }
 private static Mono<UpdateApplicationResponse> requestUpdateApplicationRename(
     CloudFoundryClient cloudFoundryClient, String applicationId, final String name) {
   return cloudFoundryClient
       .applicationsV2()
       .update(UpdateApplicationRequest.builder().applicationId(applicationId).name(name).build());
 }