use of com.google.copybara.testing.DummyOrigin in project copybara by google.
the class MetadataModuleTest method testScrubberFailWithNoPublicMsg.
@Test
public void testScrubberFailWithNoPublicMsg() throws Exception {
origin = new DummyOrigin().setAuthor(ORIGINAL_AUTHOR);
origin.addSimpleChange(0, "Confidential 1\nPUBLIC: It is a public msg\n Confidential\n");
options.testingOptions.origin = origin;
ValidationException e = assertThrows(ValidationException.class, () -> checkScrubber("This\nis\nvery confidential\nbut this is public\nvery public\n", "metadata.scrubber('^(?:\\n|.)*PUBLIC:((?:\\n|.)*)(?:\\n|.)*$', " + "fail_if_no_match = True," + "replacement = '$1')", /*not used*/
null));
assertThat(e).hasMessageThat().contains(//
"Scrubber regex: '^(?:\n|.)*PUBLIC:((?:\n|.)*)(?:\n|.)*$' didn't match for " + "description: 'This\n" + "is\n" + "very confidential\n" + "but this is public\n" + "very public\n" + "'");
}
Aggregations