You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by eb...@apache.org on 2020/04/07 00:56:14 UTC

[tomcat-jakartaee-migration] 02/10: Test with an alternative profile

This is an automated email from the ASF dual-hosted git repository.

ebourg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git

commit 07b9ad1bb056706922985b9f6eb3a13bc11b98cd
Author: Emmanuel Bourg <eb...@apache.org>
AuthorDate: Mon Apr 6 23:01:41 2020 +0200

    Test with an alternative profile
---
 src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
index a531d1d..fa0fa74 100644
--- a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
+++ b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
@@ -37,4 +37,16 @@ public class MigrationTest {
         assertFalse("Imports not migrated", migratedSource.contains("import javax.servlet"));
         assertTrue("Migrated imports not found", migratedSource.contains("import jakarta.servlet"));
     }
+
+    @Test
+    public void testMigrateSingleSourceFileWithProfile() throws Exception {
+        File migratedFile = new File("target/test-classes/HelloServlet.migrated.java");
+        Migration.main(new String[] {"-profile=EE", "target/test-classes/HelloServlet.java", migratedFile.getAbsolutePath()});
+
+        assertTrue("Migrated file not found", migratedFile.exists());
+
+        String migratedSource = FileUtils.readFileToString(migratedFile);
+        assertFalse("Imports not migrated", migratedSource.contains("import javax.servlet"));
+        assertTrue("Migrated imports not found", migratedSource.contains("import jakarta.servlet"));
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org