diff --git a/tests/tests-integrations/src/main/java/org/eclipse/dirigible/integration/tests/api/IntentEngineIT.java b/tests/tests-integrations/src/main/java/org/eclipse/dirigible/integration/tests/api/IntentEngineIT.java index 0b8ab13e54..40b46d7e56 100644 --- a/tests/tests-integrations/src/main/java/org/eclipse/dirigible/integration/tests/api/IntentEngineIT.java +++ b/tests/tests-integrations/src/main/java/org/eclipse/dirigible/integration/tests/api/IntentEngineIT.java @@ -15,6 +15,7 @@ import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.not; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -1288,6 +1289,31 @@ public void execute(DelegateExecution execution) { /* MY IMPLEMENTATION */ } "the developer's service-task handler must be preserved across regeneration"); } + @Test + void a_hand_edited_print_template_is_preserved_across_regeneration() { + writeIntent(INTENT_YAML); + restAssuredExecutor.execute(() -> given().when() + .post(GENERATE_URL) + .then() + .statusCode(200)); + // A fresh project gets the scaffold: the minimal, model-derived starting point. + String printPath = "doc/Templates/Order/Print/en/standard.print"; + String scaffold = contentOf(printPath); + assertTrue(scaffold.contains(""), + "the first Generate must scaffold the standard print template, got: " + scaffold); + + // The developer hand-improves it. A printed invoice is a formatted/audited artifact - the + // scaffold is a customization point (like the CMS seeding, which is create-if-absent), so a + // regeneration must leave the authored template BYTE-IDENTICAL, never re-emit over it. + String authored = "
{{document.Id}}
"; + writeProjectFile(printPath, authored); + restAssuredExecutor.execute(() -> given().when() + .post(GENERATE_URL) + .then() + .statusCode(200)); + assertEquals(authored, contentOf(printPath), "an authored print template must survive regeneration byte-identical"); + } + @Test void generating_the_events_template_preserves_the_full_stack_gen_output() { writeIntent(INTENT_YAML);