@Before
 public void setUp() throws CloudbreakSecuritySetupException {
   stack = TestUtil.stack();
   cluster = TestUtil.cluster(TestUtil.blueprint(), stack, 1L);
   stack.setCluster(cluster);
   clusterRequest = new ClusterRequest();
   clusterResponse = new ClusterResponse();
   when(stackService.get(anyLong())).thenReturn(stack);
   when(stackService.getById(anyLong())).thenReturn(stack);
   when(stackService.findLazy(anyLong())).thenReturn(stack);
   when(clusterRepository.save(any(Cluster.class))).thenReturn(cluster);
   given(tlsSecurityService.buildTLSClientConfig(anyLong(), anyString()))
       .willReturn(new TLSClientConfig("", "/tmp"));
 }
  @Test(expected = BadRequestException.class)
  public void testStopWhenAwsHasEphemeralVolume() {
    cluster =
        TestUtil.cluster(
            TestUtil.blueprint(), TestUtil.stack(Status.AVAILABLE, TestUtil.awsCredential()), 1L);
    stack = TestUtil.setEphemeral(cluster.getStack());
    cluster.setStatus(Status.AVAILABLE);
    cluster.setStack(stack);
    stack.setCluster(cluster);

    when(stackService.get(anyLong())).thenReturn(stack);
    when(stackService.getById(anyLong())).thenReturn(stack);

    underTest.updateStatus(1L, StatusRequest.STOPPED);
  }
 @Test(expected = BadRequestException.class)
 public void inValidNetworkRequestReturnFalse() {
   underTest.validateNetworkForStack(
       TestUtil.network("10.0.0.1/32"),
       TestUtil.generateGcpInstanceGroupsByNodeCount(10000, 10000, 10000));
 }
 @Test
 public void validNetworkRequestReturnTrue() {
   assertTrue(
       underTest.validateNetworkForStack(
           TestUtil.network(), TestUtil.generateGcpInstanceGroupsByNodeCount(1, 2, 3)));
 }
 @Override
 public AzureNetwork createSource() {
   return (AzureNetwork) TestUtil.network();
 }