-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_elseNested: Entity with more than one subfield results in multiple entities #338
Labels
Comments
Fortunately, we have a test for this. Unfortunately, the test is insufficient. All (?) tests should diff --git metamorph/src/test/java/org/metafacture/metamorph/TestMetamorphBasics.java metamorph/src/test/java/org/metafacture/metamorph/TestMetamorphBasics.java
index a564bed8..29fc828c 100644
--- metamorph/src/test/java/org/metafacture/metamorph/TestMetamorphBasics.java
+++ metamorph/src/test/java/org/metafacture/metamorph/TestMetamorphBasics.java
@@ -19,6 +19,7 @@
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
import org.junit.Rule;
import org.junit.Test;
@@ -156,6 +157,8 @@ public void shouldHandleUnmatchedLiteralsAndEntitiesInElseNestedSource() {
ordered.verify(receiver).literal("Hawaii", "Aloha");
ordered.verify(receiver).endEntity();
ordered.verify(receiver).endRecord();
+ ordered.verifyNoMoreInteractions();
+ verifyNoMoreInteractions(receiver);
}
@Test
diff --git metamorph/src/test/java/org/metafacture/metamorph/TestMetamorphBasics.java metamorph/src/test/java/org/metafacture/metamorph/TestMetamorphBasics.java
index 29fc828c..1cf6700d 100644
--- metamorph/src/test/java/org/metafacture/metamorph/TestMetamorphBasics.java
+++ metamorph/src/test/java/org/metafacture/metamorph/TestMetamorphBasics.java
@@ -151,6 +151,8 @@ public void shouldHandleUnmatchedLiteralsAndEntitiesInElseNestedSource() {
ordered.verify(receiver).literal("Shikotan", "Aekap");
ordered.verify(receiver).startEntity("Germany");
ordered.verify(receiver).literal("Langeoog", "Moin");
+ ordered.verify(receiver).endEntity();
+ ordered.verify(receiver).startEntity("Germany");
ordered.verify(receiver).literal("Baltrum", "Moin Moin");
ordered.verify(receiver).endEntity();
ordered.verify(receiver).startEntity("USA");
|
blackwinter
added a commit
that referenced
this issue
Nov 2, 2020
…ccurred at all. * Changed `shouldHandleUnmatchedLiteralsAndEntitiesInElseNestedSource` to match actual behaviour (see #338).
blackwinter
added a commit
that referenced
this issue
Nov 2, 2020
…ccurred at all. * Changed `shouldHandleUnmatchedLiteralsAndEntitiesInElseNestedSource` to match actual behaviour (see #338).
blackwinter
added a commit
that referenced
this issue
Nov 5, 2020
* Fixes #338 (see test `shouldHandleUnmatchedLiteralsAndEntitiesInElseNestedSource`; e4c6fe5). * Doesn't work with partially handled entities (see test `shouldHandlePartiallyUnmatchedLiteralsAndEntitiesInElseNestedSource`). * It should either coordinate with `Entity` w.r.t. starting/ending entities. * Or separate pass-through entities from explicitly specified entities.
dr0i
added a commit
that referenced
this issue
Nov 10, 2020
This reimplemets commit f009e28: "Data which is handled by metamorph rules will NOT be passed through (hence the aptly named "_else"). If you want to use data in the morph AND pass it through, you have to add an explicit rule for this, as usual." This behaviour is not the default, though. It can be achieved by this morph rule: <entity name='$name' sameEntity='true' reset='true' flushWith='$name' flushIncomplete='true'>" where $name is the name of the entity you want to treat. See #338.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reported by @hagbeck:
results in multiple entities like
using the '_elseNested' morph.
Originates from #107.
The text was updated successfully, but these errors were encountered: