use of com.thoughtworks.go.domain.materials.tfs.TfsCommand in project gocd by gocd.
the class TfsMaterialTest method shouldCheckConnection.
@Test
public void shouldCheckConnection() {
TestSubprocessExecutionContext execCtx = new TestSubprocessExecutionContext();
TfsCommand tfsCommand = mock(TfsCommand.class);
doNothing().when(tfsCommand).checkConnection();
TfsMaterial spy = spy(tfsMaterialFirstCollectionFirstProject);
doReturn(tfsCommand).when(spy).tfs(execCtx);
assertThat(spy.checkConnection(execCtx), Is.is(ValidationBean.valid()));
verify(tfsCommand, times(1)).checkConnection();
}
use of com.thoughtworks.go.domain.materials.tfs.TfsCommand in project gocd by gocd.
the class TfsMaterialTest method shouldShowLatestModification.
@Test
public void shouldShowLatestModification() {
File dir = tempFiles.createUniqueFolder("tfs-dir");
TestSubprocessExecutionContext execCtx = new TestSubprocessExecutionContext();
TfsMaterial spy = spy(tfsMaterialFirstCollectionSecondProject);
TfsCommand tfsCommand = mock(TfsCommand.class);
when(tfsCommand.latestModification(dir)).thenReturn(new ArrayList<>());
doReturn(tfsCommand).when(spy).tfs(execCtx);
List<Modification> actual = spy.latestModification(dir, execCtx);
assertThat(actual, is(new ArrayList<Modification>()));
verify(tfsCommand).latestModification(dir);
}
use of com.thoughtworks.go.domain.materials.tfs.TfsCommand in project gocd by gocd.
the class TfsMaterialTest method shouldLoadAllModificationsSinceAGivenRevision.
@Test
public void shouldLoadAllModificationsSinceAGivenRevision() {
File dir = tempFiles.createUniqueFolder("tfs-dir");
TestSubprocessExecutionContext execCtx = new TestSubprocessExecutionContext();
TfsMaterial spy = spy(tfsMaterialFirstCollectionFirstProject);
TfsCommand tfsCommand = mock(TfsCommand.class);
when(tfsCommand.modificationsSince(dir, new StringRevision("5"))).thenReturn(new ArrayList<>());
doReturn(tfsCommand).when(spy).tfs(execCtx);
List<Modification> actual = spy.modificationsSince(dir, new StringRevision("5"), execCtx);
assertThat(actual, is(new ArrayList<Modification>()));
verify(tfsCommand).modificationsSince(dir, new StringRevision("5"));
}
Aggregations