use of com.google.copybara.exception.NotADestinationFileException in project copybara by google.
the class WorkflowTest method errorWritingMultipleFilesThatDoNotMatchDestinationFiles.
@Test
public void errorWritingMultipleFilesThatDoNotMatchDestinationFiles() throws Exception {
// 'foo42' is like a file that is expected to be in the destination but not
// originating from the origin repo (e.g. a metadata file specific to one repo type).
// In this example, though, the file is copied from the origin, hence an error.
destinationFiles = "glob(['foo*'], exclude = ['foo42'])";
transformations = ImmutableList.of();
Path originDir = Files.createTempDirectory("change1");
Files.write(originDir.resolve("bar"), new byte[] {});
Files.write(originDir.resolve("foo_included"), new byte[] {});
Files.write(originDir.resolve("foo42"), new byte[] {});
origin.addChange(/*timestamp=*/
42, originDir, "change1", /*matchesGlob=*/
true);
Workflow<?, ?> workflow = skylarkWorkflow("default", SQUASH);
NotADestinationFileException thrown = assertThrows(NotADestinationFileException.class, () -> workflow.run(workdir, ImmutableList.of(HEAD)));
assertThat(thrown).hasMessageThat().contains("[bar, foo42]");
}
use of com.google.copybara.exception.NotADestinationFileException in project copybara by google.
the class WorkflowTest method errorWritingFileThatDoesNotMatchDestinationFiles.
@Test
public void errorWritingFileThatDoesNotMatchDestinationFiles() throws Exception {
destinationFiles = "glob(['foo*'], exclude = ['foo42'])";
transformations = ImmutableList.of();
origin.singleFileChange(/*timestamp=*/
44, "one commit", "bar.txt", "1");
Workflow<?, ?> workflow = skylarkWorkflow("default", SQUASH);
NotADestinationFileException thrown = assertThrows(NotADestinationFileException.class, () -> workflow.run(workdir, ImmutableList.of(HEAD)));
assertThat(thrown).hasMessageThat().contains("[bar.txt]");
}
Aggregations