use of org.eclipse.che.api.core.model.factory.ScmInfo in project devspaces-images by redhat-developer.
the class GithubFactoryParametersResolverTest method shouldSetScmInfoIntoDevfileV2.
@Test
public void shouldSetScmInfoIntoDevfileV2() throws Exception {
String githubUrl = "https://github.com/eclipse/che/tree/foobar";
FactoryDevfileV2Dto computedFactory = generateDevfileV2Factory();
when(urlFactoryBuilder.createFactoryFromDevfile(any(RemoteFactoryUrl.class), any(), anyMap())).thenReturn(Optional.of(computedFactory));
Map<String, String> params = ImmutableMap.of(URL_PARAMETER_NAME, githubUrl);
// when
FactoryDevfileV2Dto factory = (FactoryDevfileV2Dto) githubFactoryParametersResolver.createFactory(params);
// then
ScmInfo scmInfo = factory.getScmInfo();
assertNotNull(scmInfo);
assertEquals(scmInfo.getScmProviderName(), "github");
assertEquals(scmInfo.getRepositoryUrl(), "https://github.com/eclipse/che.git");
assertEquals(scmInfo.getBranch(), "foobar");
}
Aggregations