|
32 | 32 | import static org.hamcrest.MatcherAssert.assertThat; |
33 | 33 | import static org.hamcrest.Matchers.empty; |
34 | 34 | import static org.hamcrest.Matchers.is; |
| 35 | +import static org.hamcrest.Matchers.hasItem; |
35 | 36 | import static org.hamcrest.Matchers.hasItems; |
| 37 | +import static org.hamcrest.Matchers.not; |
36 | 38 | import static org.hamcrest.Matchers.nullValue; |
37 | 39 | import static org.mockito.ArgumentMatchers.any; |
38 | 40 | import static org.mockito.Mockito.when; |
@@ -163,14 +165,16 @@ public void getTransactionWithMultipleBridgeCallsWorksForKnownCollections() { |
163 | 165 | assertThat(collections.getWrite(), hasItems("baz", "foo")); |
164 | 166 | } |
165 | 167 |
|
166 | | - @Test(expected = IllegalTransactionStateException.class) |
167 | | - public void getTransactionWithMultipleBridgeCallsFailsForAdditionalCollection() { |
| 168 | + @Test |
| 169 | + public void getTransactionWithMultipleBridgeCallsIgnoresAdditionalCollections() { |
168 | 170 | DefaultTransactionAttribute definition = new DefaultTransactionAttribute(); |
169 | | - definition.setLabels(Collections.singleton("baz")); |
| 171 | + definition.setLabels(Collections.singleton("bar")); |
170 | 172 | definition.setTimeout(20); |
171 | | - underTest.getTransaction(definition); |
| 173 | + TransactionStatus state = underTest.getTransaction(definition); |
172 | 174 | beginTransaction("123", "foo"); |
173 | | - beginPassed.getValue().apply(Collections.singletonList("bar")); |
| 175 | + beginPassed.getValue().apply(Collections.singletonList("baz")); |
| 176 | + assertThat(getTransactionObject(state).getResource().getCollectionNames(), hasItems("foo", "bar")); |
| 177 | + assertThat(getTransactionObject(state).getResource().getCollectionNames(), not(hasItem("baz"))); |
174 | 178 | } |
175 | 179 |
|
176 | 180 | @Test(expected = InvalidIsolationLevelException.class) |
|
0 commit comments