Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Commit

Permalink
Add unit tests for array fields with asterisk wildcard. (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwinter committed Feb 2, 2022
1 parent 80f7bd3 commit 9b23eaa
Show file tree
Hide file tree
Showing 4 changed files with 623 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ public void shouldIterateOverListWithWildcard() {
shouldIterateOverList("n?me", 3);
}

@Test
@Test // checkstyle-disable-line JavaNCSS
@Disabled("See https://github.com/metafacture/metafacture-fix/issues/119")
public void shouldPerformComplexOperationWithPathWildcard() {
MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,42 @@ public void inlineDotNotationNested() {
);
}

@Test
// See https://github.com/metafacture/metafacture-fix/issues/121
public void shouldLookupArraySubFieldWithAsterisk() {
MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList(
"lookup('animals[].*.Aanimal', '" + TSV_MAP + "', 'sep_char': '\t')"
),
i -> {
i.startRecord("1");
i.startEntity("animals[]");
i.startEntity("1");
i.literal("name", "Jake");
i.literal("Aanimal", "Aloha");
i.endEntity();
i.startEntity("2");
i.literal("name", "Blacky");
i.literal("Aanimal", "Hey");
i.endEntity();
i.endEntity();
i.endRecord();
},
(o, f) -> {
o.get().startRecord("1");
o.get().startEntity("animals[]");
o.get().startEntity("1");
o.get().literal("name", "Jake");
o.get().literal("Aanimal", "Alohaeha");
o.get().endEntity();
o.get().startEntity("2");
o.get().literal("name", "Blacky");
o.get().literal("Aanimal", "Tach");
f.apply(2).endEntity();
o.get().endRecord();
}
);
}

@Test
public void csv() {
assertMap(
Expand Down
Loading

0 comments on commit 9b23eaa

Please sign in to comment.