@@ -28,7 +28,7 @@ public class FullSampleMigrationTest implements RewriteTest {
28
28
29
29
static final String GOLDEN_IMAGE = "v2" ;
30
30
static final String ORIGINAL_IMAGE = "v1" ;
31
-
31
+ static final String RECIPE_NAME = "com.azure.openrewrite.migrateToVNext" ;
32
32
static final String [] DISABLED_DIRS = {
33
33
"src/test/resources/migrationExamples/azure-storage-blob/"
34
34
};
@@ -67,13 +67,13 @@ static Stream<Path> gatherAllRegularFiles(Path sampleDir) throws IOException {
67
67
68
68
@ Override
69
69
public void defaults (RecipeSpec spec ) {
70
- spec .recipeFromResources ("com.azure.openrewrite.migrateToVNext" )
70
+ System .out .printf ("Active recipe: %s\n " , RECIPE_NAME );
71
+ spec .recipeFromResources (RECIPE_NAME )
71
72
.typeValidationOptions (TypeValidation .none ());
72
73
}
73
74
74
75
75
76
76
-
77
77
@ ParameterizedTest
78
78
@ MethodSource ("sampleDirectories" )
79
79
public void testGoldenImage (Path sampleDir ) throws Exception {
@@ -98,14 +98,20 @@ public void testGoldenImage(Path sampleDir) throws Exception {
98
98
public void assertFullMigration (Map <String ,String > fileMap ) throws IOException {
99
99
List <SourceSpecs > sourceSpecs = new ArrayList <SourceSpecs >();
100
100
for (Map .Entry <String ,String > entry : fileMap .entrySet ()) {
101
+
101
102
String before = Files .readAllLines (Paths .get (entry .getKey ()))
102
103
.stream ()
103
104
.reduce ("" , (a , b ) -> a + b + "\n " );
104
105
105
106
String after = Files .readAllLines (Paths .get (entry .getValue ()))
106
107
.stream ()
107
108
.reduce ("" , (a , b ) -> a + b + "\n " );
108
- sourceSpecs .add (java (before , after ));
109
+ if (!before .equals (after )) {
110
+ sourceSpecs .add (java (before , after ));
111
+ }
112
+ }
113
+ if (sourceSpecs .isEmpty ()) {
114
+ Assumptions .abort ("Migration samples are identical. No migration detected." );
109
115
}
110
116
rewriteRun (
111
117
sourceSpecs .toArray (new SourceSpecs [sourceSpecs .size ()])
0 commit comments