@@ -10,14 +10,12 @@ package dev.restate.sdk.springboot.kotlin
1010
1111import com.fasterxml.jackson.databind.ObjectMapper
1212import dev.restate.sdk.core.generated.manifest.EndpointManifestSchema
13- import dev.restate.sdk.core.generated.manifest.Service
1413import dev.restate.sdk.springboot.RestateHttpEndpointBean
1514import java.io.IOException
1615import java.net.URI
1716import java.net.http.HttpClient
1817import java.net.http.HttpRequest
1918import java.net.http.HttpResponse
20- import org.assertj.core.api.Assertions
2119import org.assertj.core.api.Assertions.assertThat
2220import org.junit.jupiter.api.Test
2321import org.springframework.beans.factory.annotation.Autowired
@@ -36,26 +34,23 @@ class RestateHttpEndpointBeanTest {
3634 assertThat(restateHttpEndpointBean.actualPort()).isPositive()
3735
3836 // Check if discovery replies containing the Greeter service
39- val client = HttpClient .newHttpClient ()
37+ val client = HttpClient .newBuilder().version( HttpClient . Version . HTTP_2 ).build ()
4038 val response =
41- client.send< String ?> (
39+ client.send(
4240 HttpRequest .newBuilder()
4341 .GET ()
42+ .version(HttpClient .Version .HTTP_2 )
4443 .uri(
45- URI .create(
46- (" http://localhost:" + restateHttpEndpointBean.actualPort()).toString() +
47- " /discover" ))
44+ URI .create(" http://localhost:${restateHttpEndpointBean.actualPort()} /discover" ))
4845 .header(" Accept" , " application/vnd.restate.endpointmanifest.v1+json" )
4946 .build(),
5047 HttpResponse .BodyHandlers .ofString())
51- Assertions .assertThat(response.statusCode()).isEqualTo(200 )
48+ assertThat(response.version()).isEqualTo(HttpClient .Version .HTTP_2 )
49+ assertThat(response.statusCode()).isEqualTo(200 )
5250
5351 val endpointManifest =
54- ObjectMapper ()
55- .readValue<EndpointManifestSchema >(response.body(), EndpointManifestSchema ::class .java)
52+ ObjectMapper ().readValue(response.body(), EndpointManifestSchema ::class .java)
5653
57- Assertions .assertThat<Service ?>(endpointManifest.services)
58- .map<String > { it?.name }
59- .containsOnly(" greeter" )
54+ assertThat(endpointManifest.services).map<String > { it?.name }.containsOnly(" greeter" )
6055 }
6156}
0 commit comments