Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit aa9552e

Browse files
committed
Fix javadoc of GraphQLTest
1 parent 335ffd0 commit aa9552e

File tree

4 files changed

+18
-31
lines changed

4 files changed

+18
-31
lines changed

example-graphql-tools/src/test/java/com/graphql/sample/boot/SpringBootTestWithoutWebEnvironmentTest.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

example-request-scoped-dataloader/src/test/java/graphql/servlet/examples/dataloader/requestscope/ApplicationTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.servlet.examples.dataloader.requestscope;
22

33
import static org.assertj.core.api.Assertions.assertThat;
4+
import static org.junit.jupiter.api.Assertions.assertNotNull;
45

56
import com.fasterxml.jackson.databind.JsonNode;
67
import org.junit.jupiter.api.Test;
@@ -15,7 +16,7 @@
1516

1617
@ExtendWith(SpringExtension.class)
1718
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
18-
public class ApplicationTest {
19+
class ApplicationTest {
1920

2021
@Autowired
2122
private TestRestTemplate restTemplate;
@@ -24,12 +25,13 @@ public class ApplicationTest {
2425
private CustomerRepository repository;
2526

2627
@Test
27-
public void testSanity() {
28-
this.restTemplate.getForObject("/graphql/schema.json", String.class);
28+
void testSanity() {
29+
String schema = this.restTemplate.getForObject("/graphql/schema.json", String.class);
30+
assertNotNull(schema);
2931
}
3032

3133
@Test
32-
public void testRequestScope() {
34+
void testRequestScope() {
3335

3436
String requestGraphQL = "query {\n" +
3537
" walmartCustomers(storeNumber:4177){\n" +
@@ -42,15 +44,15 @@ public void testRequestScope() {
4244
ResponseEntity<JsonNode> response = this.restTemplate
4345
.postForEntity("/graphql", new HttpEntity<>(requestGraphQL, headers), JsonNode.class);
4446

45-
assertThat(response.getBody().toString()).isEqualTo(
47+
assertThat(response.getBody()).hasToString(
4648
"{\"data\":{\"walmartCustomers\":[{\"customerId\":101,\"name\":\"Customer Name 1\"},{\"customerId\":102,\"name\":\"Customer Name 2\"},{\"customerId\":103,\"name\":\"Customer Name 3\"},{\"customerId\":104,\"name\":\"Customer Name 4\"}]}}");
4749

4850
repository.updateUsernameForId(101, "New Name 1");
4951

5052
response = this.restTemplate
5153
.postForEntity("/graphql", new HttpEntity<>(requestGraphQL, headers), JsonNode.class);
5254

53-
assertThat(response.getBody().toString()).isEqualTo(
55+
assertThat(response.getBody()).hasToString(
5456
"{\"data\":{\"walmartCustomers\":[{\"customerId\":101,\"name\":\"New Name 1\"},{\"customerId\":102,\"name\":\"Customer Name 2\"},{\"customerId\":103,\"name\":\"Customer Name 3\"},{\"customerId\":104,\"name\":\"Customer Name 4\"}]}}");
5557
}
5658

graphql-kickstart-spring-boot-autoconfigure-tools/src/test/java/graphql/kickstart/tools/boot/GraphQLToolsDirectiveTest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package graphql.kickstart.tools.boot;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
4+
35
import graphql.kickstart.tools.GraphQLQueryResolver;
46
import graphql.schema.GraphQLObjectType;
7+
import graphql.schema.GraphQLSchema;
58
import graphql.schema.idl.SchemaDirectiveWiring;
69
import graphql.schema.idl.SchemaDirectiveWiringEnvironment;
710
import org.junit.jupiter.api.AfterEach;
@@ -10,7 +13,7 @@
1013
import org.springframework.context.annotation.Configuration;
1114
import org.springframework.stereotype.Component;
1215

13-
public class GraphQLToolsDirectiveTest extends AbstractAutoConfigurationTest {
16+
class GraphQLToolsDirectiveTest extends AbstractAutoConfigurationTest {
1417

1518
public GraphQLToolsDirectiveTest() {
1619
super(GraphQLJavaToolsAutoConfiguration.class);
@@ -22,10 +25,11 @@ public void clear() {
2225
}
2326

2427
@Test
25-
public void directiveIsLoaded() {
28+
void directiveIsLoaded() {
2629
System.setProperty("graphql.tools.schemaLocationPattern",
2730
"graphql/schema-directive-test.graphql");
2831
load(BaseConfiguration.class);
32+
assertThat(this.getContext().getBean(GraphQLSchema.class)).isNotNull();
2933
}
3034

3135
@Configuration
@@ -43,7 +47,7 @@ public GraphQLObjectType onObject(
4347
}
4448

4549
@Component
46-
public class Query implements GraphQLQueryResolver {
50+
public static class Query implements GraphQLQueryResolver {
4751

4852
String schemaLocationTest(String id) {
4953
return id;

graphql-spring-boot-test-autoconfigure/src/main/java/com/graphql/spring/boot/test/GraphQLTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
4949

5050
/**
51-
* Annotation that can be specified on a test class in combination with {@code
52-
* @RunWith(SpringRunner.class)} for running tests that focus <strong>only</strong> on GraphQL
53-
* components.
51+
* Annotation that can be specified on a test class in combination with
52+
* <code>@RunWith(SpringRunner.class)</code> for running tests that focus <strong>only</strong> on
53+
* GraphQL components.
5454
* <p>
5555
* Provides the following features over the regular <strong>Spring TestContext Framework</strong>:
5656
* <ul>

0 commit comments

Comments
 (0)