@Test public void testCanChangeCredentialWithStatusIsNotAvailable() { StackApiView stackApiView = new StackApiView(); StackStatusView stackStatusView = Mockito.mock(StackStatusView.class); when(stackStatusView.getStatus()).thenReturn(Status.CREATE_IN_PROGRESS); stackApiView.setStackStatus(stackStatusView); boolean result = stackApiViewService.canChangeCredential(stackApiView); assertFalse(result); }
public boolean canChangeCredential(StackApiView stackApiView) { if (stackApiView.getStatus() != null) { if (stackApiView.getStatus() == Status.AVAILABLE) { return !flowLogService.isOtherNonTerminationFlowRunning(stackApiView.getId()); } } return false; }
StackApiViewService { public boolean canChangeCredential(StackApiView stackApiView) { if (stackApiView.getStatus() != null) { if (stackApiView.getStatus() == Status.AVAILABLE) { return !flowLogService.isOtherNonTerminationFlowRunning(stackApiView.getId()); } } return false; } }
StackApiViewService { public boolean canChangeCredential(StackApiView stackApiView) { if (stackApiView.getStatus() != null) { if (stackApiView.getStatus() == Status.AVAILABLE) { return !flowLogService.isOtherNonTerminationFlowRunning(stackApiView.getId()); } } return false; } StackApiViewService(); }
StackApiViewService { public boolean canChangeCredential(StackApiView stackApiView) { if (stackApiView.getStatus() != null) { if (stackApiView.getStatus() == Status.AVAILABLE) { return !flowLogService.isOtherNonTerminationFlowRunning(stackApiView.getId()); } } return false; } StackApiViewService(); boolean canChangeCredential(StackApiView stackApiView); StackApiView save(StackApiView stackApiView); Set<StackApiView> retrieveStackViewsByWorkspaceIdAndEnvironmentName(Long workspaceId, String environmentName, List<StackType> stackTypes); Set<StackApiView> retrieveStackViewsByWorkspaceIdAndEnvironmentCrn(Long workspaceId, String environmentCrn, List<StackType> stackTypes); @PreAuthorize("hasRole('INTERNAL')") StackApiView retrieveStackByCrnAndType(String crn, StackType stackType); }
StackApiViewService { public boolean canChangeCredential(StackApiView stackApiView) { if (stackApiView.getStatus() != null) { if (stackApiView.getStatus() == Status.AVAILABLE) { return !flowLogService.isOtherNonTerminationFlowRunning(stackApiView.getId()); } } return false; } StackApiViewService(); boolean canChangeCredential(StackApiView stackApiView); StackApiView save(StackApiView stackApiView); Set<StackApiView> retrieveStackViewsByWorkspaceIdAndEnvironmentName(Long workspaceId, String environmentName, List<StackType> stackTypes); Set<StackApiView> retrieveStackViewsByWorkspaceIdAndEnvironmentCrn(Long workspaceId, String environmentCrn, List<StackType> stackTypes); @PreAuthorize("hasRole('INTERNAL')") StackApiView retrieveStackByCrnAndType(String crn, StackType stackType);  }