Use auto-configured JSON codecs for GraphQlTester
Prior to this commit, the auto-configured `ExecutionGraphQlServiceTester` would use a default Jackson `ObjectMapper` provided by the builder for its JSON serialization/deserialization needs. Other testers, like the `HttpGraphQlTester` are based on auto-configured components which already use the auto-configured `ObjectMapper`. This commit uses the newly introduced `encoder(Encoder<?>)` and `decoder(Decoder<?>)` builder methods to configure custom JSON codecs honoring the application configuration. Closes gh-30646
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.boot.test.autoconfigure.graphql.tester;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -35,8 +36,8 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
class GraphQlTesterAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(GraphQlTesterAutoConfiguration.class));
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner().withConfiguration(
|
||||
AutoConfigurations.of(JacksonAutoConfiguration.class, GraphQlTesterAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
void shouldNotContributeTesterIfGraphQlServiceNotPresent() {
|
||||
|
||||
Reference in New Issue
Block a user