### Question:
StackUtil { public CloudCredential getCloudCredential(Stack stack) { Credential credential = credentialClientService.getByEnvironmentCrn(stack.getEnvironmentCrn()); return credentialConverter.convert(credential); }  Set<Node> collectNodes(Stack stack); Set<Node> collectReachableNodes(Stack stack); Set<Node> collectNodesFromHostnames(Stack stack, Set<String> hostnames); Set<Node> collectNodesWithDiskData(Stack stack); Set<Node> collectNewNodesWithDiskData(Stack stack, Set<String> newNodeAddresses); String extractClusterManagerIp(StackView stackView); String extractClusterManagerIp(Stack stack); String extractClusterManagerAddress(Stack stack); long getUptimeForCluster(Cluster cluster, boolean addUpsinceToUptime); CloudCredential getCloudCredential(Stack stack);  }### Answer:
@Test public void testGetCloudCredential() { Stack stack = new Stack(); stack.setEnvironmentCrn("envCrn"); CloudCredential cloudCredential = new CloudCredential("123", "CloudCred"); when(credentialClientService.getByEnvironmentCrn(anyString())).thenReturn(Credential.builder().build()); when(credentialToCloudCredentialConverter.convert(any(Credential.class))).thenReturn(cloudCredential); CloudCredential result = stackUtil.getCloudCredential(stack); assertEquals(result.getId(), cloudCredential.getId()); assertEquals(result.getName(), cloudCredential.getName()); }