@@ -353,21 +353,21 @@ public void sendAndReceive() {
353
353
Destination destination = new Destination () {};
354
354
Message <String > request = createTextMessage ();
355
355
javax .jms .Message replyJmsMessage = createJmsTextMessage ();
356
- given (jmsTemplate .sendAndReceive (eq (destination ), anyObject ())).willReturn (replyJmsMessage );
356
+ given (jmsTemplate .sendAndReceive (eq (destination ), any ())).willReturn (replyJmsMessage );
357
357
358
358
Message <?> actual = messagingTemplate .sendAndReceive (destination , request );
359
- verify (jmsTemplate , times (1 )).sendAndReceive (eq (destination ), anyObject ());
359
+ verify (jmsTemplate , times (1 )).sendAndReceive (eq (destination ), any ());
360
360
assertTextMessage (actual );
361
361
}
362
362
363
363
@ Test
364
364
public void sendAndReceiveName () {
365
365
Message <String > request = createTextMessage ();
366
366
javax .jms .Message replyJmsMessage = createJmsTextMessage ();
367
- given (jmsTemplate .sendAndReceive (eq ("myQueue" ), anyObject ())).willReturn (replyJmsMessage );
367
+ given (jmsTemplate .sendAndReceive (eq ("myQueue" ), any ())).willReturn (replyJmsMessage );
368
368
369
369
Message <?> actual = messagingTemplate .sendAndReceive ("myQueue" , request );
370
- verify (jmsTemplate , times (1 )).sendAndReceive (eq ("myQueue" ), anyObject ());
370
+ verify (jmsTemplate , times (1 )).sendAndReceive (eq ("myQueue" ), any ());
371
371
assertTextMessage (actual );
372
372
}
373
373
@@ -377,10 +377,10 @@ public void sendAndReceiveDefaultDestination() {
377
377
messagingTemplate .setDefaultDestination (destination );
378
378
Message <String > request = createTextMessage ();
379
379
javax .jms .Message replyJmsMessage = createJmsTextMessage ();
380
- given (jmsTemplate .sendAndReceive (eq (destination ), anyObject ())).willReturn (replyJmsMessage );
380
+ given (jmsTemplate .sendAndReceive (eq (destination ), any ())).willReturn (replyJmsMessage );
381
381
382
382
Message <?> actual = messagingTemplate .sendAndReceive (request );
383
- verify (jmsTemplate , times (1 )).sendAndReceive (eq (destination ), anyObject ());
383
+ verify (jmsTemplate , times (1 )).sendAndReceive (eq (destination ), any ());
384
384
assertTextMessage (actual );
385
385
}
386
386
@@ -389,10 +389,10 @@ public void sendAndReceiveDefaultDestinationName() {
389
389
messagingTemplate .setDefaultDestinationName ("myQueue" );
390
390
Message <String > request = createTextMessage ();
391
391
javax .jms .Message replyJmsMessage = createJmsTextMessage ();
392
- given (jmsTemplate .sendAndReceive (eq ("myQueue" ), anyObject ())).willReturn (replyJmsMessage );
392
+ given (jmsTemplate .sendAndReceive (eq ("myQueue" ), any ())).willReturn (replyJmsMessage );
393
393
394
394
Message <?> actual = messagingTemplate .sendAndReceive (request );
395
- verify (jmsTemplate , times (1 )).sendAndReceive (eq ("myQueue" ), anyObject ());
395
+ verify (jmsTemplate , times (1 )).sendAndReceive (eq ("myQueue" ), any ());
396
396
assertTextMessage (actual );
397
397
}
398
398
@@ -408,20 +408,20 @@ public void sendAndReceiveNoDefaultSet() {
408
408
public void convertSendAndReceivePayload () throws JMSException {
409
409
Destination destination = new Destination () {};
410
410
javax .jms .Message replyJmsMessage = createJmsTextMessage ("My reply" );
411
- given (jmsTemplate .sendAndReceive (eq (destination ), anyObject ())).willReturn (replyJmsMessage );
411
+ given (jmsTemplate .sendAndReceive (eq (destination ), any ())).willReturn (replyJmsMessage );
412
412
413
413
String reply = messagingTemplate .convertSendAndReceive (destination , "my Payload" , String .class );
414
- verify (jmsTemplate , times (1 )).sendAndReceive (eq (destination ), anyObject ());
414
+ verify (jmsTemplate , times (1 )).sendAndReceive (eq (destination ), any ());
415
415
assertEquals ("My reply" , reply );
416
416
}
417
417
418
418
@ Test
419
419
public void convertSendAndReceivePayloadName () throws JMSException {
420
420
javax .jms .Message replyJmsMessage = createJmsTextMessage ("My reply" );
421
- given (jmsTemplate .sendAndReceive (eq ("myQueue" ), anyObject ())).willReturn (replyJmsMessage );
421
+ given (jmsTemplate .sendAndReceive (eq ("myQueue" ), any ())).willReturn (replyJmsMessage );
422
422
423
423
String reply = messagingTemplate .convertSendAndReceive ("myQueue" , "my Payload" , String .class );
424
- verify (jmsTemplate , times (1 )).sendAndReceive (eq ("myQueue" ), anyObject ());
424
+ verify (jmsTemplate , times (1 )).sendAndReceive (eq ("myQueue" ), any ());
425
425
assertEquals ("My reply" , reply );
426
426
}
427
427
@@ -430,21 +430,21 @@ public void convertSendAndReceiveDefaultDestination() throws JMSException {
430
430
Destination destination = new Destination () {};
431
431
messagingTemplate .setDefaultDestination (destination );
432
432
javax .jms .Message replyJmsMessage = createJmsTextMessage ("My reply" );
433
- given (jmsTemplate .sendAndReceive (eq (destination ), anyObject ())).willReturn (replyJmsMessage );
433
+ given (jmsTemplate .sendAndReceive (eq (destination ), any ())).willReturn (replyJmsMessage );
434
434
435
435
String reply = messagingTemplate .convertSendAndReceive ("my Payload" , String .class );
436
- verify (jmsTemplate , times (1 )).sendAndReceive (eq (destination ), anyObject ());
436
+ verify (jmsTemplate , times (1 )).sendAndReceive (eq (destination ), any ());
437
437
assertEquals ("My reply" , reply );
438
438
}
439
439
440
440
@ Test
441
441
public void convertSendAndReceiveDefaultDestinationName () throws JMSException {
442
442
messagingTemplate .setDefaultDestinationName ("myQueue" );
443
443
javax .jms .Message replyJmsMessage = createJmsTextMessage ("My reply" );
444
- given (jmsTemplate .sendAndReceive (eq ("myQueue" ), anyObject ())).willReturn (replyJmsMessage );
444
+ given (jmsTemplate .sendAndReceive (eq ("myQueue" ), any ())).willReturn (replyJmsMessage );
445
445
446
446
String reply = messagingTemplate .convertSendAndReceive ("my Payload" , String .class );
447
- verify (jmsTemplate , times (1 )).sendAndReceive (eq ("myQueue" ), anyObject ());
447
+ verify (jmsTemplate , times (1 )).sendAndReceive (eq ("myQueue" ), any ());
448
448
assertEquals ("My reply" , reply );
449
449
}
450
450
@@ -459,7 +459,7 @@ public void convertMessageConversionExceptionOnSend() throws JMSException {
459
459
Message <String > message = createTextMessage ();
460
460
MessageConverter messageConverter = mock (MessageConverter .class );
461
461
willThrow (org .springframework .jms .support .converter .MessageConversionException .class )
462
- .given (messageConverter ).toMessage (eq (message ), anyObject ());
462
+ .given (messageConverter ).toMessage (eq (message ), any ());
463
463
messagingTemplate .setJmsMessageConverter (messageConverter );
464
464
invokeMessageCreator ("myQueue" );
465
465
@@ -491,7 +491,7 @@ public void convertMessageNotReadableException() throws JMSException {
491
491
@ Test
492
492
public void convertDestinationResolutionExceptionOnSend () {
493
493
Destination destination = new Destination () {};
494
- willThrow (DestinationResolutionException .class ).given (jmsTemplate ).send (eq (destination ), anyObject ());
494
+ willThrow (DestinationResolutionException .class ).given (jmsTemplate ).send (eq (destination ), any ());
495
495
496
496
thrown .expect (org .springframework .messaging .core .DestinationResolutionException .class );
497
497
messagingTemplate .send (destination , createTextMessage ());
@@ -510,7 +510,7 @@ public void convertDestinationResolutionExceptionOnReceive() {
510
510
public void convertMessageFormatException () throws JMSException {
511
511
Message <String > message = createTextMessage ();
512
512
MessageConverter messageConverter = mock (MessageConverter .class );
513
- willThrow (MessageFormatException .class ).given (messageConverter ).toMessage (eq (message ), anyObject ());
513
+ willThrow (MessageFormatException .class ).given (messageConverter ).toMessage (eq (message ), any ());
514
514
messagingTemplate .setJmsMessageConverter (messageConverter );
515
515
invokeMessageCreator ("myQueue" );
516
516
@@ -522,7 +522,7 @@ public void convertMessageFormatException() throws JMSException {
522
522
public void convertMessageNotWritableException () throws JMSException {
523
523
Message <String > message = createTextMessage ();
524
524
MessageConverter messageConverter = mock (MessageConverter .class );
525
- willThrow (MessageNotWriteableException .class ).given (messageConverter ).toMessage (eq (message ), anyObject ());
525
+ willThrow (MessageNotWriteableException .class ).given (messageConverter ).toMessage (eq (message ), any ());
526
526
messagingTemplate .setJmsMessageConverter (messageConverter );
527
527
invokeMessageCreator ("myQueue" );
528
528
@@ -532,7 +532,7 @@ public void convertMessageNotWritableException() throws JMSException {
532
532
533
533
@ Test
534
534
public void convertInvalidDestinationExceptionOnSendAndReceiveWithName () {
535
- willThrow (InvalidDestinationException .class ).given (jmsTemplate ).sendAndReceive (eq ("unknownQueue" ), anyObject ());
535
+ willThrow (InvalidDestinationException .class ).given (jmsTemplate ).sendAndReceive (eq ("unknownQueue" ), any ());
536
536
537
537
thrown .expect (org .springframework .messaging .core .DestinationResolutionException .class );
538
538
messagingTemplate .sendAndReceive ("unknownQueue" , createTextMessage ());
@@ -541,7 +541,7 @@ public void convertInvalidDestinationExceptionOnSendAndReceiveWithName() {
541
541
@ Test
542
542
public void convertInvalidDestinationExceptionOnSendAndReceive () {
543
543
Destination destination = new Destination () {};
544
- willThrow (InvalidDestinationException .class ).given (jmsTemplate ).sendAndReceive (eq (destination ), anyObject ());
544
+ willThrow (InvalidDestinationException .class ).given (jmsTemplate ).sendAndReceive (eq (destination ), any ());
545
545
546
546
thrown .expect (org .springframework .messaging .core .DestinationResolutionException .class );
547
547
messagingTemplate .sendAndReceive (destination , createTextMessage ());
@@ -555,7 +555,7 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
555
555
messageCreator .createMessage (null );
556
556
return null ;
557
557
}
558
- }).given (jmsTemplate ).send (eq ("myQueue" ), anyObject ());
558
+ }).given (jmsTemplate ).send (eq ("myQueue" ), any ());
559
559
}
560
560
561
561
0 commit comments