@@ -40,7 +40,7 @@ class JUnit5MigrationTest implements RewriteTest {
40
40
public void defaults (RecipeSpec spec ) {
41
41
spec
42
42
.parser (JavaParser .fromJavaVersion ()
43
- .classpathFromResources (new InMemoryExecutionContext (), "junit-4" ))
43
+ .classpathFromResources (new InMemoryExecutionContext (), "junit-4" , "testng" ))
44
44
.recipe (Environment .builder ()
45
45
.scanRuntimeClasspath ("org.openrewrite.java.testing.junit5" )
46
46
.build ()
@@ -51,11 +51,11 @@ public void defaults(RecipeSpec spec) {
51
51
@ Issue ("https://github.com/openrewrite/rewrite-testing-frameworks/issues/145" )
52
52
@ Test
53
53
void assertThatReceiver () {
54
- //language=java
55
54
rewriteRun (
56
55
spec -> spec
57
56
.parser (JavaParser .fromJavaVersion ()
58
57
.classpathFromResources (new InMemoryExecutionContext (), "junit-4" , "hamcrest-3" )),
58
+ //language=java
59
59
java (
60
60
"""
61
61
import org.junit.Assert;
@@ -477,6 +477,68 @@ void noJunitDependencyIfApiAlreadyPresent() {
477
477
);
478
478
}
479
479
480
+ @ Test
481
+ void noChangesIfTestNgIncluded () {
482
+ rewriteRun (
483
+ spec -> spec .beforeRecipe (withToolingApi ()),
484
+ //language=groovy
485
+ buildGradle (
486
+ """
487
+ plugins {
488
+ id 'java-library'
489
+ }
490
+ repositories {
491
+ mavenCentral()
492
+ }
493
+ dependencies {
494
+ testImplementation 'junit:junit:4.12'
495
+ testImplementation 'org.testng:testng:7.8.0'
496
+ }
497
+ tasks.withType(Test).configureEach {
498
+ useJUnitPlatform()
499
+ }
500
+ """
501
+ ),
502
+ //language=xml
503
+ pomXml (
504
+ """
505
+ <project>
506
+ <modelVersion>4.0.0</modelVersion>
507
+ <groupId>dev.ted</groupId>
508
+ <artifactId>testcontainer-migrate</artifactId>
509
+ <version>0.0.1</version>
510
+ <dependencies>
511
+ <dependency>
512
+ <groupId>junit</groupId>
513
+ <artifactId>junit</artifactId>
514
+ <version>4.12</version>
515
+ <scope>test</scope>
516
+ </dependency>
517
+ <dependency>
518
+ <groupId>org.testng</groupId>
519
+ <artifactId>testng</artifactId>
520
+ <version>7.8.0</version>
521
+ </dependency>
522
+ </dependencies>
523
+ </project>
524
+ """
525
+ ),
526
+ //language=java
527
+ java (
528
+ """
529
+ import org.junit.Ignore;
530
+ import org.testng.annotations.Test;
531
+
532
+ class ExampleClass {
533
+ @Ignore
534
+ @Test
535
+ public void testMethod() {}
536
+ }
537
+ """
538
+ )
539
+ );
540
+ }
541
+
480
542
@ Test
481
543
void bumpSurefireOnOlderMavenVersions () {
482
544
rewriteRun (
0 commit comments