use of de.dagere.peass.vcs.GitUtils in project peass by DaGeRe.
the class TestDependencyIteratorBuilder method testInitialRun.
@Test
public void testInitialRun() {
try (MockedStatic<GitUtils> gitUtil = Mockito.mockStatic(GitUtils.class)) {
gitUtil.when(() -> GitUtils.getName("HEAD", TEMPORARY_FOLDER)).thenReturn(VERSION_2);
gitUtil.when(() -> GitUtils.getName("HEAD~1", TEMPORARY_FOLDER)).thenReturn(SIMPLE_PREDECESSOR);
ExecutionConfig config = new ExecutionConfig();
config.setVersionOld(null);
config.setVersion("HEAD");
VersionIteratorGit iterator = new DependencyIteratorBuilder(config, null, new PeassFolders(TEMPORARY_FOLDER)).getIterator();
Assert.assertEquals(2, iterator.getSize());
Assert.assertEquals(VERSION_2, iterator.getTag());
Assert.assertEquals(SIMPLE_PREDECESSOR, iterator.getPredecessor());
}
}
use of de.dagere.peass.vcs.GitUtils in project peass by DaGeRe.
the class TestDependencyIteratorBuilder method testNightlyBuildWithoutPrePredecessor.
@Test
public void testNightlyBuildWithoutPrePredecessor() {
try (MockedStatic<GitUtils> gitUtil = Mockito.mockStatic(GitUtils.class)) {
gitUtil.when(() -> GitUtils.getName(Mockito.any(), Mockito.any())).thenReturn(VERSION_2);
ExecutionConfig config = new ExecutionConfig();
config.setVersionOld(null);
config.setVersion("HEAD");
StaticTestSelection dependencies = buildVersionDependencies();
DependencyIteratorBuilder builder = new DependencyIteratorBuilder(config, dependencies, new PeassFolders(TEMPORARY_FOLDER));
VersionIteratorGit iterator = builder.getIterator();
Assert.assertNull(iterator);
Assert.assertEquals(VERSION_2, builder.getVersion());
Assert.assertEquals(null, builder.getVersionOld());
}
}
Aggregations