Search in sources :

Example 1 with ContextEntry

use of sonia.scm.ContextEntry in project scm-review-plugin by scm-manager.

the class RepositoryResolverTest method testResolveRepositoryNotFound.

@Test
public void testResolveRepositoryNotFound() {
    NotFoundException exception = assertThrows(NotFoundException.class, () -> resolver.resolve(namespaceAndName));
    ContextEntry contextEntry = exception.getContext().get(0);
    assertThat(contextEntry.getType()).isEqualTo("Repository");
    assertThat(contextEntry.getId()).isEqualTo("hitchhiker/heartOfGold");
}
Also used : NotFoundException(sonia.scm.NotFoundException) ContextEntry(sonia.scm.ContextEntry) Test(org.junit.jupiter.api.Test)

Example 2 with ContextEntry

use of sonia.scm.ContextEntry in project scm-review-plugin by scm-manager.

the class RepositoryResolverTest method testResolveForUnsupportedType.

@Test
public void testResolveForUnsupportedType() {
    Repository repository = RepositoryTestData.createHeartOfGold("svn");
    repository.setId("42");
    when(repositoryManager.get(namespaceAndName)).thenReturn(repository);
    when(repositoryServiceFactory.create(repository)).thenReturn(repositoryService);
    when(repositoryService.isSupported(Command.MERGE)).thenReturn(Boolean.FALSE);
    PullRequestNotSupportedException exception = assertThrows(PullRequestNotSupportedException.class, () -> resolver.resolve(namespaceAndName));
    ContextEntry contextEntry = exception.getContext().get(0);
    assertThat(contextEntry.getType()).isEqualTo("Repository");
    assertThat(contextEntry.getId()).isEqualTo("hitchhiker/HeartOfGold");
}
Also used : Repository(sonia.scm.repository.Repository) ContextEntry(sonia.scm.ContextEntry) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 ContextEntry (sonia.scm.ContextEntry)2 NotFoundException (sonia.scm.NotFoundException)1 Repository (sonia.scm.repository.Repository)1