use of com.google.copybara.exception.ValidationException in project copybara by google.
the class HgRepositoryTest method testPullHttp.
@Test
public void testPullHttp() throws Exception {
ValidationException e = assertThrows(ValidationException.class, () -> repository.pullAll("http://copybara.com"));
assertThat(e).hasMessageThat().contains("URL 'http://copybara.com' is not valid - should be using https.");
}
use of com.google.copybara.exception.ValidationException in project copybara by google.
the class GerritApiTest method testCreateProject_invalid.
@Test
public void testCreateProject_invalid() throws Exception {
ValidationException e = assertThrows(ValidationException.class, () -> gerritApi.createProject("some project"));
assertThat(e).hasMessageThat().contains("has spaces");
}
use of com.google.copybara.exception.ValidationException in project copybara by google.
the class HgOriginTest method testUnknownChange.
@Test
public void testUnknownChange() throws Exception {
ValidationException expected = assertThrows(ValidationException.class, () -> newReader().change(origin.resolve("7")));
assertThat(expected.getMessage()).contains("Unknown revision");
}
use of com.google.copybara.exception.ValidationException in project copybara by google.
the class CopyOrMoveTest method testCannotMoveWithPathGlobsSpecificFile.
@Test
public void testCannotMoveWithPathGlobsSpecificFile() throws Exception {
CopyOrMove t = skylark.eval("m", "m = core.move('foo', '' , paths = glob(['foo.txt']))");
touch("foo/foo.txt");
touch("foo.txt");
ValidationException e = assertThrows(ValidationException.class, () -> transform(t));
assertThat(e).hasMessageThat().contains("Cannot move file to '" + checkoutDir + "/foo.txt' because it already exists");
}
use of com.google.copybara.exception.ValidationException in project copybara by google.
the class CopyOrMoveTest method testFailMoveToCheckoutDirRoot.
@Test
public void testFailMoveToCheckoutDirRoot() throws Exception {
CopyOrMove mover = skylark.eval("m", "m = core.move(before = 'third_party/java/one.java', after = '')\n");
touch("third_party/java/one.java");
ValidationException e = assertThrows(ValidationException.class, () -> transform(mover));
assertThat(e).hasMessageThat().contains("Can only move a path to the root when the path is a " + "folder. But 'third_party/java/one.java' is a file. Use instead " + "core.move('third_party/java/one.java', 'one.java')");
assertThatPath(checkoutDir).containsFiles("third_party/java/one.java").containsNoMoreFiles();
}
Aggregations