Created
April 21, 2026 23:28
-
-
Save sualeh/0007f42cc4b3e23a157a4de87dab652e to your computer and use it in GitHub Desktop.
Old application code with old and new database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.junit.jupiter.api.ClassOrderer; | |
| import org.junit.jupiter.api.DisplayName; | |
| import org.junit.jupiter.api.Nested; | |
| import org.junit.jupiter.api.Order; | |
| import org.junit.jupiter.api.Test; | |
| import org.junit.jupiter.api.TestClassOrder; | |
| @DisplayName("Old application code with old and new database") | |
| @TestClassOrder(ClassOrderer.OrderAnnotation.class) // Enables test ordering | |
| public class OldCodeWithOldAndNewDatabase { | |
| @Nested | |
| @DisplayName("Old application code with old database") | |
| @TrymigrateWhenTarget("1.0") | |
| @Order(1) // <-- Runs first | |
| public class OldCodeWithOldDatabase { | |
| @Test | |
| public void testApplication() { | |
| testApplicationCode(); | |
| } | |
| } | |
| @Nested | |
| @DisplayName("Old application code with new database") | |
| @TrymigrateWhenTarget("1.1") | |
| @Order(2) // ← Runs second | |
| public class OldCodeWithNewDatabase { | |
| @Test | |
| public void testApplication() { | |
| testApplicationCode(); | |
| } | |
| } | |
| private void testApplicationCode() { | |
| // Application tests and asserts | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment