1919import static org .junit .jupiter .api .Assertions .assertEquals ;
2020
2121import java .io .IOException ;
22+ import java .util .ArrayList ;
2223import java .util .Arrays ;
2324import java .util .HashMap ;
2425import java .util .List ;
@@ -85,11 +86,11 @@ public void releaseResources() throws IOException {
8586 verifyNotEquivalent (NAME , "direct" , false , true , null );
8687 }
8788
88- @ Test public void exchangeDeclaredWithEnumerationEquivalentOnNonRecoverableConnection () throws IOException , InterruptedException {
89+ @ Test public void exchangeDeclaredWithEnumerationEquivalentOnNonRecoverableConnection () throws IOException {
8990 doTestExchangeDeclaredWithEnumerationEquivalent (channel );
9091 }
9192
92- @ Test public void exchangeDeclaredWithEnumerationEquivalentOnRecoverableConnection () throws IOException , TimeoutException , InterruptedException {
93+ @ Test public void exchangeDeclaredWithEnumerationEquivalentOnRecoverableConnection () throws IOException , TimeoutException {
9394 ConnectionFactory connectionFactory = TestUtils .connectionFactory ();
9495 connectionFactory .setAutomaticRecoveryEnabled (true );
9596 connectionFactory .setTopologyRecoveryEnabled (false );
@@ -102,13 +103,17 @@ public void releaseResources() throws IOException {
102103
103104 }
104105
105- private void doTestExchangeDeclaredWithEnumerationEquivalent (Channel channel ) throws IOException , InterruptedException {
106+ private void doTestExchangeDeclaredWithEnumerationEquivalent (Channel channel ) throws IOException {
106107 // Only test AMQP 0-9-1 standard types; plugin and newer core types
107108 // (e.g. x-modulus-hash, x-local-random) may not be available on the test broker
108109 List <BuiltinExchangeType > standardTypes = Arrays .asList (
109110 BuiltinExchangeType .DIRECT , BuiltinExchangeType .FANOUT ,
110111 BuiltinExchangeType .TOPIC , BuiltinExchangeType .HEADERS
111112 );
113+ if (TestUtils .isVersion43orLater (channel .getConnection ())) {
114+ standardTypes = new ArrayList <>(standardTypes );
115+ standardTypes .add (BuiltinExchangeType .MODULUS_HASH );
116+ }
112117 for (BuiltinExchangeType exchangeType : standardTypes ) {
113118 channel .exchangeDeclare (NAME , exchangeType );
114119 verifyEquivalent (NAME , exchangeType .getType (), false , false , null );
0 commit comments