use of com.google.copybara.TransformWork in project copybara by google.
the class RevisionMigratorTest method testReverseRegexEnforced.
@Test
public void testReverseRegexEnforced() throws Exception {
String desc = "This is an awesome change, building on http://internalReviews.com/123";
referenceMigrator = ReferenceMigrator.create("http://internalReviews.com/${reference}", "http://externalreviews.com/view?${reference}", Pattern.compile("[0-9]+"), Pattern.compile("[xyz]+"), ImmutableList.of(), location);
TransformWork work = getTransformWork(desc);
ValidationException thrown = assertThrows(ValidationException.class, () -> referenceMigrator.transform(work));
assertThat(thrown).hasMessageThat().contains("Reference 7b does not match regex '[xyz]+'");
}
Aggregations