Skip to content

Commit ac2ecbb

Browse files
author
Simon MacMullen
committed
expectError() handles the already-closed case too. Don't hard code 403.
1 parent 06f5c66 commit ac2ecbb

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

test/src/com/rabbitmq/client/test/functional/InternalExchange.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
package com.rabbitmq.client.test.functional;
3333

34+
import com.rabbitmq.client.AMQP;
3435
import com.rabbitmq.client.DefaultConsumer;
3536
import com.rabbitmq.client.GetResponse;
3637
import com.rabbitmq.client.test.BrokerTestCase;
@@ -97,18 +98,7 @@ public void testTryPublishingToInternalExchange()
9798

9899
// Publishing to the internal exchange will not be allowed...
99100
channel.basicPublish("e1", "", null, testDataBody);
100-
try
101-
{
102-
// The channel should have shut down as a result of the forbidden
103-
// attempt to publish to an internal exchange...
104-
DefaultConsumer consumer = new DefaultConsumer(channel);
105-
channel.basicConsume("q1", consumer);
106-
fail("Channel should have shut down with 403 (access refused).");
107-
}
108-
catch (IOException e)
109-
{
110-
// We should get 403, access refused...
111-
checkShutdownSignal(403, e);
112-
}
101+
102+
expectError(AMQP.ACCESS_REFUSED);
113103
}
114104
}

0 commit comments

Comments
 (0)