### Question:
AutoLoginCredentialsFinder { public AutoLoginCredentials getCredential(ProcessIdentifier processIdentifier, long tenantId){ AutoLoginCredentials autoLoginCredentials = getAutoLoginCredentials(processIdentifier, tenantId); return autoLoginCredentials; } AutoLoginCredentialsFinder(ConfigurationFilesManager configurationFilesManager); AutoLoginCredentials getCredential(ProcessIdentifier processIdentifier, long tenantId);  }### Answer:
@Test public void should_retrieve_credentials_when_autologin_available_for_the_requested_process_and_tenant() throws Exception{ when(configurationFilesManager.getTenantAutoLoginConfiguration(TENANT_ID)).thenReturn(autoLoginConfiguration); AutoLoginCredentials autoLoginCredentials = autoLoginCredentialsFinder.getCredential(new ProcessIdentifier("my process", "2.0"), TENANT_ID); assertThat(autoLoginCredentials.getUserName()).isEqualTo("john.bates"); assertThat(autoLoginCredentials.getPassword()).isEqualTo("bpm"); }
@Test public void should_retrieve_empty_credentials_when_autologin_not_available_for_the_requested_process_and_tenant() throws Exception{ when(configurationFilesManager.getTenantAutoLoginConfiguration(TENANT_ID)).thenReturn(autoLoginConfiguration); AutoLoginCredentials autoLoginCredentials = autoLoginCredentialsFinder.getCredential(new ProcessIdentifier("process without autologin", "1.0"), TENANT_ID); assertThat(autoLoginCredentials).isEqualTo(null); }
@Test public void should_retrieve_empty_credentials_when_cannot_read_configuration() throws Exception{ when(configurationFilesManager.getTenantAutoLoginConfiguration(TENANT_ID)).thenReturn(null); AutoLoginCredentials autoLoginCredentials = autoLoginCredentialsFinder.getCredential(new ProcessIdentifier("process without autologin", "1.0"), TENANT_ID); assertThat(autoLoginCredentials).isEqualTo(null); }