Search in sources :

Example 41 with EmptyChangeException

use of com.google.copybara.exception.EmptyChangeException in project copybara by google.

the class GitHubPrOriginTest method gitResolveRequiredCheckRunsFail.

@Test
public void gitResolveRequiredCheckRunsFail() throws Exception {
    MockPullRequest.create(gitUtil).setState("open").setPrNumber(125).addLabels("bar: yes").addCheckRun("foo/one", "success").addCheckRun("foo/two", "failure").mock();
    EmptyChangeException thrown = assertThrows(EmptyChangeException.class, () -> checkResolve(githubPrOrigin("url = 'https://github.com/google/example'", "required_check_runs = ['foo/one', 'foo/two']"), sha, 125));
    assertThat(thrown).hasMessageThat().contains("Cannot migrate http://github.com/google/example/pull/125 because the following check" + " runs have not been passed: [foo/two]");
}
Also used : EmptyChangeException(com.google.copybara.exception.EmptyChangeException) Test(org.junit.Test)

Example 42 with EmptyChangeException

use of com.google.copybara.exception.EmptyChangeException in project copybara by google.

the class GitHubPrOriginTest method testAlreadyClosed_only_closed.

@Test
public void testAlreadyClosed_only_closed() throws Exception {
    MockPullRequest.create(gitUtil).setState("open").setPrNumber(125).addLabels("foo: yes").mock();
    EmptyChangeException thrown = assertThrows(EmptyChangeException.class, () -> checkResolve(githubPrOrigin("url = 'https://github.com/google/example', state = 'CLOSED'"), "125", 125));
    assertThat(thrown).hasMessageThat().contains("Pull Request 125 is open");
}
Also used : EmptyChangeException(com.google.copybara.exception.EmptyChangeException) Test(org.junit.Test)

Aggregations

EmptyChangeException (com.google.copybara.exception.EmptyChangeException)42 Test (org.junit.Test)27 ImmutableList (com.google.common.collect.ImmutableList)10 RepoException (com.google.copybara.exception.RepoException)10 ValidationException (com.google.copybara.exception.ValidationException)10 ProfilerTask (com.google.copybara.profiler.Profiler.ProfilerTask)10 Path (java.nio.file.Path)10 CannotResolveRevisionException (com.google.copybara.exception.CannotResolveRevisionException)8 Endpoint (com.google.copybara.Endpoint)7 VisibleForTesting (com.google.common.annotations.VisibleForTesting)5 CharMatcher (com.google.common.base.CharMatcher)5 Preconditions (com.google.common.base.Preconditions)5 Splitter (com.google.common.base.Splitter)5 Collections2 (com.google.common.collect.Collections2)5 ImmutableSetMultimap (com.google.common.collect.ImmutableSetMultimap)5 Iterables (com.google.common.collect.Iterables)5 Sets (com.google.common.collect.Sets)5 Uninterruptibles (com.google.common.util.concurrent.Uninterruptibles)5 BaselinesWithoutLabelVisitor (com.google.copybara.BaselinesWithoutLabelVisitor)5 Change (com.google.copybara.Change)5