From d20530ecbd7e6b3f09c78f3de8259afbde0b09a6 Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Thu, 26 Sep 2024 12:06:23 +0200 Subject: [PATCH] Add MetafixToDo test for adding with $last in implicit array (#369) --- .../metafix/MetafixRecordTest.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/metafix/src/test/java/org/metafacture/metafix/MetafixRecordTest.java b/metafix/src/test/java/org/metafacture/metafix/MetafixRecordTest.java index c6f6baa5..8c3360a8 100644 --- a/metafix/src/test/java/org/metafacture/metafix/MetafixRecordTest.java +++ b/metafix/src/test/java/org/metafacture/metafix/MetafixRecordTest.java @@ -393,6 +393,42 @@ public void addWithPrependInImplicitArray() { ); } + @Test + @MetafixToDo("See https://github.com/metafacture/metafacture-fix/issues/369") + public void addWithLastInImplicitArray() { + MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( + "add_field('my.name.$last','patrick')", + "add_field('my.name.$last','nicolas')" + ), + i -> { + i.startRecord("1"); + i.endRecord(); + + i.startRecord("2"); + i.startEntity("my"); + i.literal("name", "max"); + i.endEntity(); + i.endRecord(); + + i.startRecord("3"); + i.endRecord(); + }, + o -> { + o.get().startRecord("1"); + o.get().endRecord(); + + o.get().startRecord("2"); + o.get().startEntity("my"); + o.get().literal("name", "nicolas"); + o.get().endEntity(); + o.get().endRecord(); + + o.get().startRecord("3"); + o.get().endRecord(); + } + ); + } + @Test public void addWithAppendInArray() { MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList(