// Path: src/main/java/io/pivotal/strepsirrhini/chaosloris/data/Application.java
// @Entity
// public class Application {
// 
//     @Column(nullable = false, unique = true)
//     private UUID applicationId;
// 
//     @Column(nullable = false)
//     @GeneratedValue
//     @Id
//     @JsonIgnore
//     private Long id;
// 
//     /**
//      * Create a new instance
//      *
//      * @param applicationId the Cloud Foundry application id
//      */
//     public Application(UUID applicationId) {
//         this.applicationId = applicationId;
//     }
// 
//     Application() {
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) {
//             return true;
//         }
//         if (o == null || getClass() != o.getClass()) {
//             return false;
//         }
//         Application that = (Application) o;
//         return Objects.equals(this.applicationId, that.applicationId) &&
//             Objects.equals(this.id, that.id);
//     }
// 
//     /**
//      * Returns the application id
//      *
//      * @return the application id
//      */
//     public UUID getApplicationId() {
//         return this.applicationId;
//     }
// 
//     /**
//      * Returns the id
//      *
//      * @return the id
//      */
//     public Long getId() {
//         return this.id;
//     }
// 
//     /**
//      * Sets the id
//      *
//      * @param id the id
//      */
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(this.applicationId, this.id);
//     }
// 
//     @Override
//     public String toString() {
//         return "Application{" +
//             "applicationId=" + this.applicationId +
//             ", id=" + this.id +
//             '}';
//     }
// 
// }


import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import io.pivotal.strepsirrhini.chaosloris.data.Application;
import org.cloudfoundry.client.CloudFoundryClient;
import org.cloudfoundry.client.v2.applications.ApplicationsV2;
import org.cloudfoundry.client.v2.applications.SummaryApplicationRequest;
import org.cloudfoundry.client.v2.applications.SummaryApplicationResponse;
import org.cloudfoundry.client.v2.applications.TerminateApplicationInstanceRequest;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import java.util.UUID;
import static org.mockito.Mockito.RETURNS_SMART_NULLS;
/*
 * Copyright 2015-2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.pivotal.strepsirrhini.chaosloris.destroyer;




public final class CloudFoundryPlatformTest {

    private final ApplicationsV2 applications = mock(ApplicationsV2.class, RETURNS_SMART_NULLS);

    private final CloudFoundryClient cloudFoundryClient = mock(CloudFoundryClient.class, RETURNS_SMART_NULLS);

    private final CloudFoundryPlatform platform = new CloudFoundryPlatform(this.cloudFoundryClient);

    @Test
    public void getInstanceCount() {
        UUID applicationId = UUID.randomUUID();

        requestApplicationSummary(this.cloudFoundryClient, applicationId.toString(), Mono.just(SummaryApplicationResponse.builder()
            .instances(1)
            .build()));

// Path: src/main/java/io/pivotal/strepsirrhini/chaosloris/data/Application.java
// @Entity
// public class Application {
// 
//     @Column(nullable = false, unique = true)
//     private UUID applicationId;
// 
//     @Column(nullable = false)
//     @GeneratedValue
//     @Id
//     @JsonIgnore
//     private Long id;
// 
//     /**
//      * Create a new instance
//      *
//      * @param applicationId the Cloud Foundry application id
//      */
//     public Application(UUID applicationId) {
//         this.applicationId = applicationId;
//     }
// 
//     Application() {
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) {
//             return true;
//         }
//         if (o == null || getClass() != o.getClass()) {
//             return false;
//         }
//         Application that = (Application) o;
//         return Objects.equals(this.applicationId, that.applicationId) &&
//             Objects.equals(this.id, that.id);
//     }
// 
//     /**
//      * Returns the application id
//      *
//      * @return the application id
//      */
//     public UUID getApplicationId() {
//         return this.applicationId;
//     }
// 
//     /**
//      * Returns the id
//      *
//      * @return the id
//      */
//     public Long getId() {
//         return this.id;
//     }
// 
//     /**
//      * Sets the id
//      *
//      * @param id the id
//      */
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(this.applicationId, this.id);
//     }
// 
//     @Override
//     public String toString() {
//         return "Application{" +
//             "applicationId=" + this.applicationId +
//             ", id=" + this.id +
//             '}';
//     }
// 
// }


// Path: src/test/java/io/pivotal/strepsirrhini/chaosloris/destroyer/CloudFoundryPlatformTest.java
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import io.pivotal.strepsirrhini.chaosloris.data.Application;
import org.cloudfoundry.client.CloudFoundryClient;
import org.cloudfoundry.client.v2.applications.ApplicationsV2;
import org.cloudfoundry.client.v2.applications.SummaryApplicationRequest;
import org.cloudfoundry.client.v2.applications.SummaryApplicationResponse;
import org.cloudfoundry.client.v2.applications.TerminateApplicationInstanceRequest;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import java.util.UUID;
import static org.mockito.Mockito.RETURNS_SMART_NULLS;

/*
 * Copyright 2015-2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.pivotal.strepsirrhini.chaosloris.destroyer;




public final class CloudFoundryPlatformTest {

    private final ApplicationsV2 applications = mock(ApplicationsV2.class, RETURNS_SMART_NULLS);

    private final CloudFoundryClient cloudFoundryClient = mock(CloudFoundryClient.class, RETURNS_SMART_NULLS);

    private final CloudFoundryPlatform platform = new CloudFoundryPlatform(this.cloudFoundryClient);

    @Test
    public void getInstanceCount() {
        UUID applicationId = UUID.randomUUID();

        requestApplicationSummary(this.cloudFoundryClient, applicationId.toString(), Mono.just(SummaryApplicationResponse.builder()
            .instances(1)
            .build()));

        this.platform.getInstanceCount(new Application(applicationId))