@@ -64,7 +64,8 @@ public void setup() {
6464 @ Test
6565 public void should_discover_instances_when_application_is_ready () {
6666 when (discovery .getServices ()).thenReturn (Collections .singletonList ("service" ));
67- when (discovery .getInstances ("service" )).thenReturn (Collections .singletonList (new DefaultServiceInstance ("service" ,
67+ when (discovery .getInstances ("service" )).thenReturn (Collections .singletonList (new DefaultServiceInstance ("test-1" ,
68+ "service" ,
6869 "localhost" ,
6970 80 ,
7071 false
@@ -81,7 +82,7 @@ public void should_discover_instances_when_application_is_ready() {
8182 @ Test
8283 public void should_not_register_instance_when_serviceId_is_ignored () {
8384 when (discovery .getServices ()).thenReturn (singletonList ("service" ));
84- when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("service" ,
85+ when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("test-1" , " service" ,
8586 "localhost" ,
8687 80 ,
8788 false
@@ -96,7 +97,7 @@ public void should_not_register_instance_when_serviceId_is_ignored() {
9697 @ Test
9798 public void should_register_instance_when_serviceId_is_not_ignored () {
9899 when (discovery .getServices ()).thenReturn (singletonList ("service" ));
99- when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("service" ,
100+ when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("test-1" , " service" ,
100101 "localhost" ,
101102 80 ,
102103 false
@@ -111,7 +112,7 @@ public void should_register_instance_when_serviceId_is_not_ignored() {
111112 @ Test
112113 public void should_not_register_instance_when_serviceId_matches_ignored_pattern () {
113114 when (discovery .getServices ()).thenReturn (asList ("service" , "rabbit-1" , "rabbit-2" ));
114- when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("service" ,
115+ when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("test-1" , " service" ,
115116 "localhost" ,
116117 80 ,
117118 false
@@ -128,7 +129,7 @@ public void should_not_register_instance_when_serviceId_matches_ignored_pattern(
128129 @ Test
129130 public void should_register_instances_when_serviceId_matches_wanted_pattern () {
130131 when (discovery .getServices ()).thenReturn (asList ("service" , "rabbit-1" , "rabbit-2" ));
131- when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("service" ,
132+ when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("test-1" , " service" ,
132133 "localhost" ,
133134 80 ,
134135 false
@@ -145,12 +146,13 @@ public void should_register_instances_when_serviceId_matches_wanted_pattern() {
145146 @ Test
146147 public void should_register_instances_when_serviceId_matches_wanted_pattern_and_igonred_pattern () {
147148 when (discovery .getServices ()).thenReturn (asList ("service-1" , "service" , "rabbit-1" , "rabbit-2" ));
148- when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("service" ,
149+ when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("test-1" , " service" ,
149150 "localhost" ,
150151 80 ,
151152 false
152153 )));
153- when (discovery .getInstances ("service-1" )).thenReturn (singletonList (new DefaultServiceInstance ("service-1" ,
154+ when (discovery .getInstances ("service-1" )).thenReturn (singletonList (new DefaultServiceInstance ("test-1" ,
155+ "service-1" ,
154156 "localhost" ,
155157 80 ,
156158 false
@@ -168,7 +170,7 @@ public void should_register_instances_when_serviceId_matches_wanted_pattern_and_
168170 @ Test
169171 public void should_register_instance_when_new_service_instance_is_discovered () {
170172 when (discovery .getServices ()).thenReturn (singletonList ("service" ));
171- when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("service" ,
173+ when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("test-1" , " service" ,
172174 "localhost" ,
173175 80 ,
174176 false
@@ -191,7 +193,7 @@ public void should_only_discover_new_instances_when_new_heartbeat_is_emitted() {
191193 listener .onParentHeartbeat (new ParentHeartbeatEvent (new Object (), heartbeat ));
192194
193195 when (discovery .getServices ()).thenReturn (singletonList ("service" ));
194- when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("service" ,
196+ when (discovery .getInstances ("service" )).thenReturn (singletonList (new DefaultServiceInstance ("test-1" , " service" ,
195197 "localhost" ,
196198 80 ,
197199 false
@@ -217,8 +219,8 @@ public void should_remove_instances_when_they_are_no_longer_available_in_discove
217219 listener .setIgnoredServices (singleton ("ignored" ));
218220
219221 List <ServiceInstance > instances = new ArrayList <>();
220- instances .add (new DefaultServiceInstance ("service" , "localhost" , 80 , false ));
221- instances .add (new DefaultServiceInstance ("service" , "example.net" , 80 , false ));
222+ instances .add (new DefaultServiceInstance ("test-1" , " service" , "localhost" , 80 , false ));
223+ instances .add (new DefaultServiceInstance ("test-1" , " service" , "example.net" , 80 , false ));
222224
223225 when (discovery .getServices ()).thenReturn (singletonList ("service" ));
224226 when (discovery .getInstances ("service" )).thenReturn (instances );
@@ -264,11 +266,11 @@ public void should_remove_instances_when_they_are_no_longer_available_in_discove
264266 @ Test
265267 public void should_not_throw_error_when_conversion_fails_and_proceed_with_next_instance () {
266268 when (discovery .getServices ()).thenReturn (singletonList ("service" ));
267- when (discovery .getInstances ("service" )).thenReturn (asList (new DefaultServiceInstance ("service" ,
269+ when (discovery .getInstances ("service" )).thenReturn (asList (new DefaultServiceInstance ("test-1" , " service" ,
268270 "localhost" ,
269271 80 ,
270272 false
271- ), new DefaultServiceInstance ("error" , "localhost" , 80 , false )));
273+ ), new DefaultServiceInstance ("error-1" , "error " , "localhost" , 80 , false )));
272274 listener .setConverter (instance -> {
273275 if (instance .getServiceId ().equals ("error" )) {
274276 throw new IllegalStateException ("Test-Error" );
0 commit comments