### Question:
PasswordGeneratorService { public String generatePassword(Optional<CloudPlatform> cloudPlatform) { if (cloudPlatform.isPresent()) { switch (cloudPlatform.get()) { case AWS: case GCP: case MOCK: return uuidGeneratorService.uuidVariableParts(AWS_MAX_LENGTH); case AZURE: String candidatePassword; do { candidatePassword = StringUtils.left(uuidGeneratorService.randomUuid(), AZURE_MAX_LENGTH); } while (!passesAzureCharacterRules(candidatePassword)); return candidatePassword; default: throw new UnsupportedOperationException("Password generation for " + cloudPlatform.get() + " not yet implemented"); } } else { return uuidGeneratorService.randomUuid(); } }  String generatePassword(Optional<CloudPlatform> cloudPlatform);  }### Answer:
@Test public void testAwsPassword() { when(uuidGeneratorService.uuidVariableParts(PasswordGeneratorService.AWS_MAX_LENGTH)).thenReturn("uuid"); assertEquals("uuid", underTest.generatePassword(Optional.of(CloudPlatform.AWS))); verify(uuidGeneratorService).uuidVariableParts(PasswordGeneratorService.AWS_MAX_LENGTH); }
@Test public void testGeneralPassword() { when(uuidGeneratorService.randomUuid()).thenReturn("uuid"); assertEquals("uuid", underTest.generatePassword(Optional.empty())); verify(uuidGeneratorService).randomUuid(); }