Search in sources :

Example 41 with TransformWork

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]+'");
}
Also used : ValidationException(com.google.copybara.exception.ValidationException) TransformWork(com.google.copybara.TransformWork) Test(org.junit.Test)

Aggregations

TransformWork (com.google.copybara.TransformWork)41 Test (org.junit.Test)33 Transformation (com.google.copybara.Transformation)23 TransformationStatus (com.google.copybara.TransformationStatus)9 DummyRevision (com.google.copybara.testing.DummyRevision)6 Changes (com.google.copybara.Changes)5 Author (com.google.copybara.authoring.Author)5 ValidationException (com.google.copybara.exception.ValidationException)4 Change (com.google.copybara.Change)3 ProcessedChange (com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange)3 EmptyChangeException (com.google.copybara.exception.EmptyChangeException)2 NonReversibleValidationException (com.google.copybara.exception.NonReversibleValidationException)2 RepoException (com.google.copybara.exception.RepoException)2 TransformWorks.toChange (com.google.copybara.testing.TransformWorks.toChange)2 Strings (com.google.common.base.Strings)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMultimap (com.google.common.collect.ImmutableMultimap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Iterables (com.google.common.collect.Iterables)1 Lists (com.google.common.collect.Lists)1