Skip to content

Commit 98bd5cd

Browse files
committed
Add unit test for replace_all() with array. (#255)
1 parent c8ba171 commit 98bd5cd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,29 @@ public void shouldReplaceAllRegexesInArraySubField() {
20172017
);
20182018
}
20192019

2020+
@Test
2021+
// See https://github.com/metafacture/metafacture-fix/issues/255
2022+
public void shouldFailToReplaceAllInRepeatedSubfieldOfObjectWithAsterisk() {
2023+
MetafixTestHelpers.assertProcessException(IllegalArgumentException.class, "Can't find: 2 in: null", () ->
2024+
MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList(
2025+
"replace_all('predecessor[].*.label', 'Vorg. ---> ', '')"
2026+
),
2027+
i -> {
2028+
i.startRecord("1");
2029+
i.startEntity("predecessor[]");
2030+
i.startEntity("1");
2031+
i.literal("label", "Früher u.d.T.");
2032+
i.literal("label", "Gewaltprävention in Schule und Jugendhilfe");
2033+
i.endEntity();
2034+
i.endEntity();
2035+
i.endRecord();
2036+
},
2037+
o -> {
2038+
}
2039+
)
2040+
);
2041+
}
2042+
20202043
@Test
20212044
public void shouldNotInsertOptionalArraySubFieldWithAsteriskInReplaceAll() {
20222045
MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList(

0 commit comments

Comments
 (0)