@Test public void testCloneManagedRepository() { when(view.isGitUrlEmpty()).thenReturn(false); when(repositoryPreferences.isOUMandatory()).thenReturn(false); when(view.getGitUrl()).thenReturn(REPO_URL); when(view.getName()).thenReturn(REPO_NAME); presenter.handleCloneClick(); verifyRepoCloned(true); verify(repoService, times(1)).createRepository(any(OrganizationalUnit.class), anyString(), anyString(), repositoryEnvironmentConfigurationsArgumentCaptor.capture()); final RepositoryEnvironmentConfigurations configurations = repositoryEnvironmentConfigurationsArgumentCaptor.getValue(); assertEquals(USERNAME, configurations.getUserName()); assertEquals(PASSWORD, configurations.getPassword()); assertEquals(REPO_URL, configurations.getOrigin()); }
@Test public void testCloneNotManagedRepository() { when(view.isGitUrlEmpty()).thenReturn(false); when(repositoryPreferences.isOUMandatory()).thenReturn(false); when(view.getGitUrl()).thenReturn(REPO_URL); when(view.getName()).thenReturn(REPO_NAME); presenter.handleCloneClick(); verifyRepoCloned(true); verify(repoService, times(1)).createRepository(any(OrganizationalUnit.class), anyString(), anyString(), repositoryEnvironmentConfigurationsArgumentCaptor.capture()); final RepositoryEnvironmentConfigurations configurations = repositoryEnvironmentConfigurationsArgumentCaptor.getValue(); assertEquals(USERNAME, configurations.getUserName()); assertEquals(PASSWORD, configurations.getPassword()); assertEquals(REPO_URL, configurations.getOrigin()); }
@Test public void testCloneNotManagedRepository() { when(view.isGitUrlEmpty()).thenReturn(false); when(repositoryPreferences.isOUMandatory()).thenReturn(false); when(view.getGitUrl()).thenReturn(REPO_URL); when(view.getName()).thenReturn(REPO_NAME); when(view.isManagedRepository()).thenReturn(false); presenter.handleCloneClick(); verifyRepoCloned(true); verify(repoService, times(1)).createRepository(any(OrganizationalUnit.class), anyString(), anyString(), repositoryEnvironmentConfigurationsArgumentCaptor.capture()); final RepositoryEnvironmentConfigurations configurations = repositoryEnvironmentConfigurationsArgumentCaptor.getValue(); assertEquals(USERNAME, configurations.getUserName()); assertEquals(PASSWORD, configurations.getPassword()); assertEquals(REPO_URL, configurations.getOrigin()); assertFalse(configurations.isManaged()); }
@Test public void testCloneManagedRepository() { when(view.isGitUrlEmpty()).thenReturn(false); when(repositoryPreferences.isOUMandatory()).thenReturn(false); when(view.getGitUrl()).thenReturn(REPO_URL); when(view.getName()).thenReturn(REPO_NAME); when(view.isManagedRepository()).thenReturn(true); presenter.handleCloneClick(); verifyRepoCloned(true); verify(repoService, times(1)).createRepository(any(OrganizationalUnit.class), anyString(), anyString(), repositoryEnvironmentConfigurationsArgumentCaptor.capture()); final RepositoryEnvironmentConfigurations configurations = repositoryEnvironmentConfigurationsArgumentCaptor.getValue(); assertEquals(USERNAME, configurations.getUserName()); assertEquals(PASSWORD, configurations.getPassword()); assertEquals(REPO_URL, configurations.getOrigin()); assertTrue(configurations.isManaged()); }
RepositoryEnvironmentConfigurations observedConfig = configCaptor.getValue(); assertEquals(username, observedConfig.getUserName()); assertEquals(password, observedConfig.getPassword());
RepositoryEnvironmentConfigurations observedConfig = configCaptor.getValue(); assertEquals(username, observedConfig.getUserName()); assertEquals(password, observedConfig.getPassword());