Skip to content

Commit 006e3ac

Browse files
committed
Remove unnecessary parens, add unit test (#102, #149, #170)
1 parent 238e840 commit 006e3ac

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

metafix/src/main/java/org/metafacture/metafix/FixPath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public String toString() {
136136
result = new FixPath(replaceInPath(ASTERISK, i));
137137
}
138138
// Multiple * or wildcards: use the old value's path
139-
else if (value.getPath() != null && (countAsterisks() >= 2) || hasWildcard()) {
139+
else if (value.getPath() != null && countAsterisks() >= 2 || hasWildcard()) {
140140
result = new FixPath(value.getPath());
141141
}
142142
else {

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,36 @@ public void shouldNotDeleteNonFoundLookupExplicitly() {
369369
);
370370
}
371371

372+
@Test
373+
// See https://github.com/metafacture/metafacture-fix/issues/149
374+
public void shouldDeleteNonFoundLookupOnDemandNonRepeatedField() {
375+
MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList(
376+
"lookup('title', Aloha: Alohaeha, 'Moin': 'Moin zäme', delete: 'true')"
377+
),
378+
i -> {
379+
i.startRecord("1");
380+
i.literal("title", "Aloha");
381+
i.endRecord();
382+
i.startRecord("2");
383+
i.literal("title", "Moin");
384+
i.endRecord();
385+
i.startRecord("3");
386+
i.literal("title", "Yo");
387+
i.endRecord();
388+
},
389+
o -> {
390+
o.get().startRecord("1");
391+
o.get().literal("title", "Alohaeha");
392+
o.get().endRecord();
393+
o.get().startRecord("2");
394+
o.get().literal("title", "Moin zäme");
395+
o.get().endRecord();
396+
o.get().startRecord("3");
397+
o.get().endRecord();
398+
}
399+
);
400+
}
401+
372402
@Test
373403
public void shouldDeleteNonFoundLookupOnDemandAndVacuum() {
374404
MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList(

0 commit comments

Comments
 (0)