Skip to content

Instantly share code, notes, and snippets.

@sualeh
Created April 21, 2026 23:28
Show Gist options
  • Select an option

  • Save sualeh/0007f42cc4b3e23a157a4de87dab652e to your computer and use it in GitHub Desktop.

Select an option

Save sualeh/0007f42cc4b3e23a157a4de87dab652e to your computer and use it in GitHub Desktop.
Old application code with old and new database
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