@@ -285,18 +285,18 @@ public void execute() {
285
285
286
286
assertEquals ("Expected operation result differs from actual" , expectedResult , actualResult );
287
287
}
288
- assertFalse (String .format ("Expected error '%s' but none thrown" , getErrorContainsField ( expectedResult )) ,
289
- hasErrorContainsField (expectedResult ));
290
- assertFalse (String .format ("Expected error code '%s' but none thrown" , getErrorCodeNameField ( expectedResult )) ,
291
- hasErrorCodeNameField (expectedResult ));
288
+ assertFalse (String .format ("Expected error '%s' but none thrown for operation %s" ,
289
+ getErrorContainsField ( expectedResult ), operationName ), hasErrorContainsField (expectedResult ));
290
+ assertFalse (String .format ("Expected error code '%s' but none thrown for operation %s" ,
291
+ getErrorCodeNameField ( expectedResult ), operationName ), hasErrorCodeNameField (expectedResult ));
292
292
} catch (RuntimeException e ) {
293
293
boolean passedAssertion = false ;
294
294
if (hasErrorLabelsContainField (expectedResult )) {
295
295
if (e instanceof MongoException ) {
296
296
MongoException mongoException = (MongoException ) e ;
297
297
for (String curErrorLabel : getErrorLabelsContainField (expectedResult )) {
298
- assertTrue (String .format ("Expected error label '%s but found labels '%s'" , curErrorLabel ,
299
- mongoException .getErrorLabels ()),
298
+ assertTrue (String .format ("Expected error label '%s but found labels '%s' for operation %s" ,
299
+ curErrorLabel , mongoException .getErrorLabels (), operationName ),
300
300
mongoException .hasErrorLabel (curErrorLabel ));
301
301
}
302
302
passedAssertion = true ;
@@ -306,17 +306,17 @@ public void execute() {
306
306
if (e instanceof MongoException ) {
307
307
MongoException mongoException = (MongoException ) e ;
308
308
for (String curErrorLabel : getErrorLabelsOmitField (expectedResult )) {
309
- assertFalse (String .format ("Expected error label '%s omitted but found labels '%s'" , curErrorLabel ,
310
- mongoException .getErrorLabels ()),
309
+ assertFalse (String .format ("Expected error label '%s omitted but found labels '%s' for operation %s" ,
310
+ curErrorLabel , mongoException .getErrorLabels (), operationName ),
311
311
mongoException .hasErrorLabel (curErrorLabel ));
312
312
}
313
313
passedAssertion = true ;
314
314
}
315
315
}
316
316
if (hasErrorContainsField (expectedResult )) {
317
317
String expectedError = getErrorContainsField (expectedResult );
318
- assertTrue (String .format ("Expected '%s' but got '%s'" , expectedError , e .getMessage () ),
319
- e .getMessage ().toLowerCase ().contains (expectedError .toLowerCase ()));
318
+ assertTrue (String .format ("Expected '%s' but got '%s' for operation %s " , expectedError , e .getMessage (),
319
+ operationName ), e .getMessage ().toLowerCase ().contains (expectedError .toLowerCase ()));
320
320
passedAssertion = true ;
321
321
}
322
322
if (hasErrorCodeNameField (expectedResult )) {
@@ -331,7 +331,8 @@ public void execute() {
331
331
}
332
332
if (!passedAssertion ) {
333
333
throw e ;
334
- } }
334
+ }
335
+ }
335
336
}
336
337
} finally {
337
338
closeAllSessions ();
0 commit comments