|
19 | 19 | import static org.junit.Assert.assertEquals;
|
20 | 20 | import static org.junit.Assert.assertNull;
|
21 | 21 | import static org.mockito.Mockito.inOrder;
|
| 22 | +import static org.mockito.Mockito.times; |
| 23 | +import static org.mockito.Mockito.verifyNoMoreInteractions; |
22 | 24 | import static org.mockito.Mockito.when;
|
23 | 25 |
|
24 | 26 | import org.junit.Before;
|
|
33 | 35 | import org.mockito.junit.MockitoJUnit;
|
34 | 36 | import org.mockito.junit.MockitoRule;
|
35 | 37 |
|
36 |
| - |
37 | 38 | /**
|
38 | 39 | * Tests for class {@link Lookup}.
|
39 | 40 | *
|
@@ -127,6 +128,7 @@ public void shouldLookupValuesInLocalMap() {
|
127 | 128 | ordered.verify(receiver).literal("2", "B");
|
128 | 129 | ordered.verify(receiver).endRecord();
|
129 | 130 | ordered.verifyNoMoreInteractions();
|
| 131 | + verifyNoMoreInteractions(receiver); |
130 | 132 | }
|
131 | 133 |
|
132 | 134 | @Test
|
@@ -190,4 +192,31 @@ public void shouldLookupValuesInMetadata() {
|
190 | 192 | ordered.verifyNoMoreInteractions();
|
191 | 193 | }
|
192 | 194 |
|
| 195 | + @Test |
| 196 | + public void issue372_shouldFilterMissingValue() { |
| 197 | + final Metamorph metamorph = InlineMorph.in(this) |
| 198 | + .with("<rules>") |
| 199 | + .with(" <data source='litA'>") |
| 200 | + .with(" <lookup>") |
| 201 | + .with(" <entry name='cat' value='mammal' />") |
| 202 | + .with(" <entry name='dog' value='mammal' />") |
| 203 | + .with(" </lookup>") |
| 204 | + .with(" </data>") |
| 205 | + .with("</rules>") |
| 206 | + .createConnectedTo(receiver); |
| 207 | + |
| 208 | + metamorph.startRecord("1"); |
| 209 | + metamorph.literal("litA", "cat"); |
| 210 | + metamorph.literal("litA", "dog"); |
| 211 | + metamorph.literal("litA", "dragon"); |
| 212 | + metamorph.endRecord(); |
| 213 | + |
| 214 | + final InOrder ordered = inOrder(receiver); |
| 215 | + ordered.verify(receiver).startRecord("1"); |
| 216 | + ordered.verify(receiver, times(2)).literal("litA", "mammal"); |
| 217 | + ordered.verify(receiver).endRecord(); |
| 218 | + ordered.verifyNoMoreInteractions(); |
| 219 | + verifyNoMoreInteractions(receiver); |
| 220 | + } |
| 221 | + |
193 | 222 | }
|
0 commit comments