2222import org .junit .Test ;
2323import org .mockito .Mockito ;
2424
25+ import java .io .IOException ;
2526import java .util .concurrent .ExecutorService ;
2627import java .util .concurrent .Executors ;
2728
@@ -30,22 +31,31 @@ public class ChannelNTest {
3031 ConsumerWorkService consumerWorkService ;
3132 ExecutorService executorService ;
3233
33- @ Before public void init () {
34+ @ Before
35+ public void init () {
3436 executorService = Executors .newSingleThreadExecutor ();
3537 consumerWorkService = new ConsumerWorkService (executorService , null , 1000 , 1000 );
3638 }
3739
38- @ After public void tearDown () {
40+ @ After
41+ public void tearDown () {
3942 consumerWorkService .shutdown ();
4043 executorService .shutdownNow ();
4144 }
4245
4346 @ Test
44- public void cancelUnknownConsumerDoesNotThrowException () throws Exception {
47+ public void serverBasicCancelForUnknownConsumerDoesNotThrowException () throws Exception {
4548 AMQConnection connection = Mockito .mock (AMQConnection .class );
4649 ChannelN channel = new ChannelN (connection , 1 , consumerWorkService );
4750 Method method = new AMQImpl .Basic .Cancel .Builder ().consumerTag ("does-not-exist" ).build ();
4851 channel .processAsync (new AMQCommand (method ));
4952 }
5053
54+ @ Test (expected = IOException .class )
55+ public void callingBasicCancelForUnknownConsumerThrowsException () throws Exception {
56+ AMQConnection connection = Mockito .mock (AMQConnection .class );
57+ ChannelN channel = new ChannelN (connection , 1 , consumerWorkService );
58+ channel .basicCancel ("does-not-exist" );
59+ }
60+
5161}
0 commit comments