@Test void testFinalizeTerminationFroInstancesWithoutInstanceIds() { Stack stack = mock(Stack.class); InstanceMetaData im1 = mock(InstanceMetaData.class); InstanceMetaData im2 = mock(InstanceMetaData.class); InstanceMetaData im3 = mock(InstanceMetaData.class); InstanceMetaData im4 = mock(InstanceMetaData.class); when(stackService.getByIdWithListsInTransaction(1L)).thenReturn(stack); when(stack.getAllInstanceMetaDataList()).thenReturn(List.of(im1, im2, im3, im4)); when(im1.isTerminated()).thenReturn(true); when(im2.isTerminated()).thenReturn(false); when(im3.isTerminated()).thenReturn(false); when(im4.isTerminated()).thenReturn(false); when(im2.getInstanceId()).thenReturn(null); when(im3.getInstanceId()).thenReturn("i-3"); when(im4.getInstanceId()).thenReturn(null); when(clock.getCurrentTimeMillis()).thenReturn(1L); underTest.finalizeTerminationForInstancesWithoutInstanceIds(1L); verify(im2).setTerminationDate(any()); verify(im2).setInstanceStatus(eq(InstanceStatus.TERMINATED)); verify(im4).setTerminationDate(any()); verify(im4).setInstanceStatus(eq(InstanceStatus.TERMINATED)); verify(instanceMetaDataService).saveAll(any()); }
public void finalizeTerminationForInstancesWithoutInstanceIds(Long stackId) { Stack stack = stackService.getByIdWithListsInTransaction(stackId); terminateInstancesWithoutInstanceIds(stack); }
TerminationService { public void finalizeTerminationForInstancesWithoutInstanceIds(Long stackId) { Stack stack = stackService.getByIdWithListsInTransaction(stackId); terminateInstancesWithoutInstanceIds(stack); } }
TerminationService { public void finalizeTerminationForInstancesWithoutInstanceIds(Long stackId) { Stack stack = stackService.getByIdWithListsInTransaction(stackId); terminateInstancesWithoutInstanceIds(stack); }  }
TerminationService { public void finalizeTerminationForInstancesWithoutInstanceIds(Long stackId) { Stack stack = stackService.getByIdWithListsInTransaction(stackId); terminateInstancesWithoutInstanceIds(stack); }  void finalizeTermination(Long stackId); void finalizeTermination(Long stackId, List<String> instanceIds); void finalizeTerminationForInstancesWithoutInstanceIds(Long stackId); }
TerminationService { public void finalizeTerminationForInstancesWithoutInstanceIds(Long stackId) { Stack stack = stackService.getByIdWithListsInTransaction(stackId); terminateInstancesWithoutInstanceIds(stack); }  void finalizeTermination(Long stackId); void finalizeTermination(Long stackId, List<String> instanceIds); void finalizeTerminationForInstancesWithoutInstanceIds(Long stackId);  }