use of com.google.api.services.container.v1beta1.Container.Projects.Locations.Clusters.Get in project platinum by hartwigmedical.
the class KubernetesEngineTest method shouldCreateAndReturnInstanceWhenNoneExists.
@Test
public void shouldCreateAndReturnInstanceWhenNoneExists() throws IOException {
Get foundOperation = mock(Get.class);
Create created = mock(Create.class);
Operation executedCreate = mock(Operation.class);
when(clusters.get(anyString())).thenReturn(foundOperation);
when(foundOperation.execute()).thenThrow(GoogleJsonResponseException.class);
when(clusters.create(eq(format("projects/%s/locations/%s", PROJECT, REGION)), any())).thenReturn(created);
when(created.execute()).thenReturn(executedCreate);
when(executedCreate.getName()).thenReturn("created");
mockForClusterCreation();
victim.findOrCreate(RUN_NAME, Collections.emptyList(), JSON_KEY, BUCKET, SERVICE_ACCOUNT);
verify(created).execute();
}
Aggregations