use of com.google.copybara.exception.ValidationException in project copybara by google.
the class GerritDestinationTest method testSubmitAndDisableNotifications.
@Test
public void testSubmitAndDisableNotifications() {
ValidationException expected = assertThrows(ValidationException.class, () -> destination("submit = True", "notify = 'OWNER'"));
assertThat(expected).hasMessageThat().contains("Cannot set 'notify' with 'submit = True' in git.gerrit_destination()");
}
use of com.google.copybara.exception.ValidationException in project copybara by google.
the class GerritDestinationTest method testChangeIdPolicyFailIfPresent.
@Test
public void testChangeIdPolicyFailIfPresent() throws Exception {
options.gerrit.gerritChangeId = null;
options.gitDestination.nonFastForwardPush = true;
String changeId = runChangeIdPolicy("Test message", "change_id_policy = 'FAIL_IF_PRESENT'");
assertThat(changeId).isNotNull();
ValidationException e = assertThrows(ValidationException.class, () -> runChangeIdPolicy("Test message\n\nChange-Id: " + CONSTANT_CHANGE_ID + "\n", "change_id_policy = 'FAIL_IF_PRESENT'"));
assertThat(e).hasMessageThat().contains("label found in message");
}
use of com.google.copybara.exception.ValidationException in project copybara by google.
the class GerritDestinationTest method testSubmitAndTopic.
@Test
public void testSubmitAndTopic() {
ValidationException expected = assertThrows(ValidationException.class, () -> destination("submit = True", "topic = 'test_${CONTEXT_REFERENCE}'"));
assertThat(expected).hasMessageThat().contains("Cannot set 'topic' with 'submit = True' in git.gerrit_destination()");
}
use of com.google.copybara.exception.ValidationException in project copybara by google.
the class FolderOriginTest method testAbsolutePaths.
@Test
public void testAbsolutePaths() throws Exception {
ValidationException thrown = assertThrows(ValidationException.class, () -> runAbsolutePaths("folder.origin()"));
assertThat(thrown).hasMessageThat().contains("Some symlinks refer to locations outside of the folder and" + " 'materialize_outside_symlinks' config option was not used");
}
use of com.google.copybara.exception.ValidationException in project copybara by google.
the class GerritEndpointTest method testFeedbackGetChange_malformedJson.
@Test
public void testFeedbackGetChange_malformedJson() throws Exception {
gitUtil.mockApi(anyString(), anyString(), mockResponse("foo bar"));
Feedback feedback = notifyChangeToOriginFeedback();
ValidationException expected = assertThrows(ValidationException.class, () -> feedback.run(workdir, ImmutableList.of("12345")));
assertThat(expected).hasMessageThat().contains("Error while executing the skylark transformation test_action");
Throwable cause = expected.getCause();
assertThat(cause).isInstanceOf(IllegalArgumentException.class);
assertThat(dummyTrigger.messages).isEmpty();
}
Aggregations