Upgrade samples to match the GraphQlTest updates
See gh-310
This commit is contained in:
@@ -54,9 +54,14 @@ public class ProjectControllerTests {
|
||||
|
||||
@Test
|
||||
void jsonPath() {
|
||||
given(this.projectsClient.fetchProject(eq("spring-framework"))).willReturn(this.springFramework);
|
||||
given(this.projectsClient.fetchProjectReleases(eq("spring-framework"))).willReturn(Collections.singletonList(this.latestRelease));
|
||||
this.graphQlTester.queryName("projectReleases")
|
||||
|
||||
given(this.projectsClient.fetchProject(eq("spring-framework")))
|
||||
.willReturn(this.springFramework);
|
||||
|
||||
given(this.projectsClient.fetchProjectReleases(eq("spring-framework")))
|
||||
.willReturn(Collections.singletonList(this.latestRelease));
|
||||
|
||||
this.graphQlTester.documentName("projectReleases")
|
||||
.variable("slug", "spring-framework")
|
||||
.execute()
|
||||
.path("project.releases[*].version")
|
||||
@@ -68,7 +73,7 @@ public class ProjectControllerTests {
|
||||
@Test
|
||||
void jsonContent() {
|
||||
given(this.projectsClient.fetchProject(eq("spring-framework"))).willReturn(this.springFramework);
|
||||
this.graphQlTester.queryName("projectRepositoryUrl")
|
||||
this.graphQlTester.documentName("projectRepositoryUrl")
|
||||
.variable("slug", "spring-framework")
|
||||
.execute()
|
||||
.path("project")
|
||||
@@ -77,9 +82,14 @@ public class ProjectControllerTests {
|
||||
|
||||
@Test
|
||||
void decodedResponse() {
|
||||
given(this.projectsClient.fetchProject(eq("spring-framework"))).willReturn(this.springFramework);
|
||||
given(this.projectsClient.fetchProjectReleases(eq("spring-framework"))).willReturn(Collections.singletonList(this.latestRelease));
|
||||
this.graphQlTester.queryName("projectReleases")
|
||||
|
||||
given(this.projectsClient.fetchProject(eq("spring-framework")))
|
||||
.willReturn(this.springFramework);
|
||||
|
||||
given(this.projectsClient.fetchProjectReleases(eq("spring-framework")))
|
||||
.willReturn(Collections.singletonList(this.latestRelease));
|
||||
|
||||
this.graphQlTester.documentName("projectReleases")
|
||||
.variable("slug", "spring-framework")
|
||||
.execute()
|
||||
.path("project")
|
||||
|
||||
@@ -19,20 +19,20 @@ package io.spring.sample.graphql.repository;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.graphql.tester.AutoConfigureWebGraphQlTester;
|
||||
import org.springframework.boot.test.autoconfigure.graphql.tester.AutoConfigureGraphQlTester;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.graphql.test.tester.WebGraphQlTester;
|
||||
import org.springframework.graphql.test.tester.GraphQlTester;
|
||||
|
||||
@SpringBootTest
|
||||
@AutoConfigureWebGraphQlTester
|
||||
@AutoConfigureGraphQlTester
|
||||
class ArtifactRepositoriesTests {
|
||||
|
||||
@Autowired
|
||||
private WebGraphQlTester graphQlTester;
|
||||
private GraphQlTester graphQlTester;
|
||||
|
||||
@Test
|
||||
void querydslRepositorySingle() {
|
||||
this.graphQlTester.queryName("artifactRepository")
|
||||
this.graphQlTester.documentName("artifactRepository")
|
||||
.variable("id", "spring-releases")
|
||||
.execute()
|
||||
.path("artifactRepository.name")
|
||||
@@ -41,7 +41,7 @@ class ArtifactRepositoriesTests {
|
||||
|
||||
@Test
|
||||
void querydslRepositoryMany() {
|
||||
this.graphQlTester.queryName("artifactRepositories")
|
||||
this.graphQlTester.documentName("artifactRepositories")
|
||||
.execute()
|
||||
.path("artifactRepositories[*].id")
|
||||
.entityList(String.class).containsExactly("spring-releases", "spring-milestones");
|
||||
|
||||
Reference in New Issue
Block a user