@@ -58,6 +58,62 @@ public Map<String, Object> restCall(Object client, String baseUri, String vhost,
58
58
return Map .of ("node" , "a@b" );
59
59
}
60
60
}
61
+
62
+ });
63
+ ConnectionFactory factory = nodeLocator .locate (new String [] { "http://foo" , "http://bar" },
64
+ Map .of ("a@b" , "baz" ), null , "q" , null , null , (q , n , u ) -> {
65
+ return null ;
66
+ });
67
+ verify (nodeLocator , times (2 )).restCall (any (), any (), any (), any ());
68
+ }
69
+
70
+ @ Test
71
+ @ DisplayName ("rest returned null" )
72
+ void nullInfo () throws URISyntaxException {
73
+
74
+ NodeLocator <Object > nodeLocator = spy (new NodeLocator <Object >() {
75
+
76
+ @ Override
77
+ public Object createClient (String userName , String password ) {
78
+ return null ;
79
+ }
80
+
81
+ @ Override
82
+ @ Nullable
83
+ public Map <String , Object > restCall (Object client , String baseUri , String vhost , String queue ) {
84
+ if (baseUri .contains ("foo" )) {
85
+ return null ;
86
+ }
87
+ else {
88
+ return Map .of ("node" , "a@b" );
89
+ }
90
+ }
91
+
92
+ });
93
+ ConnectionFactory factory = nodeLocator .locate (new String [] { "http://foo" , "http://bar" },
94
+ Map .of ("a@b" , "baz" ), null , "q" , null , null , (q , n , u ) -> {
95
+ return null ;
96
+ });
97
+ verify (nodeLocator , times (2 )).restCall (any (), any (), any (), any ());
98
+ }
99
+
100
+ @ Test
101
+ @ DisplayName ("queue not found" )
102
+ void notFound () throws URISyntaxException {
103
+
104
+ NodeLocator <Object > nodeLocator = spy (new NodeLocator <Object >() {
105
+
106
+ @ Override
107
+ public Object createClient (String userName , String password ) {
108
+ return null ;
109
+ }
110
+
111
+ @ Override
112
+ @ Nullable
113
+ public Map <String , Object > restCall (Object client , String baseUri , String vhost , String queue ) {
114
+ return null ;
115
+ }
116
+
61
117
});
62
118
ConnectionFactory factory = nodeLocator .locate (new String [] { "http://foo" , "http://bar" },
63
119
Map .of ("a@b" , "baz" ), null , "q" , null , null , (q , n , u ) -> {
0 commit comments