2020import java .util .LinkedHashMap ;
2121import java .util .List ;
2222
23- import com .ecwid .consul .v1 .ConsulClient ;
24- import com .ecwid .consul .v1 .QueryParams ;
25- import com .ecwid .consul .v1 .Response ;
26- import com .ecwid .consul .v1 .kv .model .GetValue ;
2723import org .apache .commons .logging .LogFactory ;
2824import org .junit .Test ;
2925
26+ import org .springframework .cloud .consul .ConsulClient ;
27+ import org .springframework .cloud .consul .model .http .kv .GetValue ;
28+ import org .springframework .http .HttpHeaders ;
29+ import org .springframework .http .HttpStatus ;
30+ import org .springframework .http .ResponseEntity ;
31+
3032import static org .assertj .core .api .Assertions .assertThat ;
31- import static org .mockito .ArgumentMatchers .any ;
3233import static org .mockito .ArgumentMatchers .eq ;
3334import static org .mockito .ArgumentMatchers .nullable ;
3435import static org .mockito .Mockito .mock ;
@@ -48,8 +49,8 @@ public class ConsulPropertySourcesTests {
4849 @ Test
4950 public void createPropertySourceStoresNormalizedContextInIndex () {
5051 ConsulClient consul = mock (ConsulClient .class );
51- Response <List <GetValue >> response = new Response <>( Collections . emptyList (), 1L , false , 1L );
52- when (consul .getKVValues (eq ("test/" ), nullable (String .class ), any ( QueryParams . class ) )).thenReturn (response );
52+ ResponseEntity <List <GetValue >> response = new ResponseEntity < List < GetValue >>( HttpStatus . OK );
53+ when (consul .getKVValues (eq ("test/" ), nullable (String .class ))).thenReturn (response );
5354
5455 ConsulConfigProperties properties = new ConsulConfigProperties ();
5556 ConsulPropertySources sources = new ConsulPropertySources (properties ,
@@ -65,7 +66,10 @@ public void createPropertySourceStoresNormalizedContextInIndex() {
6566 @ Test
6667 public void createPropertySourceFilesFormatStoresNormalizedContextInIndex () {
6768 ConsulClient consul = mock (ConsulClient .class );
68- Response <GetValue > response = new Response <>(null , 1L , false , 1L );
69+ ResponseEntity <List <GetValue >> response = mock (ResponseEntity .class );
70+ when (response .getStatusCode ()).thenReturn (HttpStatus .OK );
71+ when (response .getBody ()).thenReturn (Collections .emptyList ());
72+ when (response .getHeaders ()).thenReturn (new HttpHeaders ());
6973 when (consul .getKVValue (eq ("test.yml" ), nullable (String .class ))).thenReturn (response );
7074
7175 ConsulConfigProperties properties = new ConsulConfigProperties ();
0 commit comments