diff --git a/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAutoConfigurationCustomConfigTest.java b/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAutoConfigurationCustomConfigTest.java index 02a95d79..ba24fc14 100644 --- a/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAutoConfigurationCustomConfigTest.java +++ b/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAutoConfigurationCustomConfigTest.java @@ -9,7 +9,7 @@ @ActiveProfiles({"test", "custom-subscription-path"}) @DisplayName("Testing the auto-configuration of the GraphQLTestSubscription bean / custom subscription endpoint.") -public class GraphQLTestSubscriptionAutoConfigurationCustomConfigTest extends +class GraphQLTestSubscriptionAutoConfigurationCustomConfigTest extends GraphQLTestAutoConfigurationTestBase { @Test diff --git a/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAutoConfigurationDefaultConfigTest.java b/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAutoConfigurationDefaultConfigTest.java index beb2a1e4..c78ba904 100644 --- a/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAutoConfigurationDefaultConfigTest.java +++ b/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAutoConfigurationDefaultConfigTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; @DisplayName("Testing the auto-configuration of the GraphQLTestSubscription bean / default settings.") -public class GraphQLTestSubscriptionAutoConfigurationDefaultConfigTest extends +class GraphQLTestSubscriptionAutoConfigurationDefaultConfigTest extends GraphQLTestAutoConfigurationTestBase { @Test diff --git a/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateAutoConfigurationCustomConfigTest.java b/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateAutoConfigurationCustomConfigTest.java index a63f2dca..1fb92da8 100644 --- a/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateAutoConfigurationCustomConfigTest.java +++ b/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateAutoConfigurationCustomConfigTest.java @@ -10,7 +10,7 @@ @ActiveProfiles({"test", "custom-servlet-mapping"}) @DisplayName("Testing auto-configuration of the GraphQLTestTemplate bean / custom servlet endpoint.") -public class GraphQLTestTemplateAutoConfigurationCustomConfigTest extends +class GraphQLTestTemplateAutoConfigurationCustomConfigTest extends GraphQLTestAutoConfigurationTestBase { @Test diff --git a/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateAutoConfigurationDefaultConfigTest.java b/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateAutoConfigurationDefaultConfigTest.java index e67f3465..bacb50c4 100644 --- a/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateAutoConfigurationDefaultConfigTest.java +++ b/graphql-spring-boot-test-autoconfigure/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateAutoConfigurationDefaultConfigTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; @DisplayName("Testing auto-configuration of the GraphQLTestTemplate bean / default servlet endpoint.") -public class GraphQLTestTemplateAutoConfigurationDefaultConfigTest extends +class GraphQLTestTemplateAutoConfigurationDefaultConfigTest extends GraphQLTestAutoConfigurationTestBase { @Test diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/GraphQLTestSubscription.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/GraphQLTestSubscription.java index 75e8ef1f..fc555ed0 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/GraphQLTestSubscription.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/GraphQLTestSubscription.java @@ -23,6 +23,7 @@ import javax.websocket.ClientEndpointConfig; import javax.websocket.CloseReason; import javax.websocket.ContainerProvider; +import javax.websocket.DeploymentException; import javax.websocket.Endpoint; import javax.websocket.EndpointConfig; import javax.websocket.MessageHandler; @@ -377,7 +378,7 @@ public List getRemainingResponses() { return graphQLResponses; } - private void initClient() throws Exception { + private void initClient() throws IOException, DeploymentException { final String port = environment.getProperty("local.server.port"); final URI uri = URI_BUILDER_FACTORY.builder().scheme("ws").host("localhost").port(port) .path(subscriptionPath) diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/RequestFactory.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/RequestFactory.java index 2d7de3fc..a83272db 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/RequestFactory.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/RequestFactory.java @@ -12,7 +12,7 @@ private RequestFactory() { } static HttpEntity forJson(String json, HttpHeaders headers) { - headers.setContentType(MediaType.APPLICATION_JSON_UTF8); + headers.setContentType(MediaType.APPLICATION_JSON); return new HttpEntity<>(json, headers); } diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBigDecimalAssert.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBigDecimalAssert.java index 5dfe38ef..1cece721 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBigDecimalAssert.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBigDecimalAssert.java @@ -2,8 +2,10 @@ import com.graphql.spring.boot.test.GraphQLResponse; import java.math.BigDecimal; +import lombok.EqualsAndHashCode; import org.assertj.core.api.AbstractBigDecimalAssert; +@EqualsAndHashCode(callSuper = true) public class GraphQLBigDecimalAssert extends AbstractBigDecimalAssert implements GraphQLResponseAssertion { diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBigIntegerAssert.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBigIntegerAssert.java index 92c3ef53..641afa9e 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBigIntegerAssert.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBigIntegerAssert.java @@ -2,8 +2,10 @@ import com.graphql.spring.boot.test.GraphQLResponse; import java.math.BigInteger; +import lombok.EqualsAndHashCode; import org.assertj.core.api.AbstractBigIntegerAssert; +@EqualsAndHashCode(callSuper = true) public class GraphQLBigIntegerAssert extends AbstractBigIntegerAssert implements GraphQLResponseAssertion { diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBooleanAssert.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBooleanAssert.java index 3c4496a7..c4a97908 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBooleanAssert.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLBooleanAssert.java @@ -1,8 +1,10 @@ package com.graphql.spring.boot.test.assertions; import com.graphql.spring.boot.test.GraphQLResponse; +import lombok.EqualsAndHashCode; import org.assertj.core.api.AbstractBooleanAssert; +@EqualsAndHashCode(callSuper = true) public class GraphQLBooleanAssert extends AbstractBooleanAssert implements GraphQLResponseAssertion { diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLByteAssert.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLByteAssert.java index 002812f4..0e0db077 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLByteAssert.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLByteAssert.java @@ -1,8 +1,10 @@ package com.graphql.spring.boot.test.assertions; import com.graphql.spring.boot.test.GraphQLResponse; +import lombok.EqualsAndHashCode; import org.assertj.core.api.AbstractByteAssert; +@EqualsAndHashCode(callSuper = true) public class GraphQLByteAssert extends AbstractByteAssert implements GraphQLResponseAssertion { diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLErrorListAssertion.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLErrorListAssertion.java index dd22a55e..0c7822b7 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLErrorListAssertion.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLErrorListAssertion.java @@ -10,10 +10,12 @@ import graphql.GraphQLError; import java.util.List; import java.util.stream.Collectors; +import lombok.EqualsAndHashCode; import org.assertj.core.api.FactoryBasedNavigableListAssert; import org.assertj.core.api.ObjectAssert; import org.assertj.core.api.ObjectAssertFactory; +@EqualsAndHashCode(callSuper = true) public class GraphQLErrorListAssertion extends FactoryBasedNavigableListAssert< GraphQLErrorListAssertion, List, diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLGenericObjectAssert.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLGenericObjectAssert.java index a0194c69..15c5f7d0 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLGenericObjectAssert.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLGenericObjectAssert.java @@ -1,8 +1,10 @@ package com.graphql.spring.boot.test.assertions; import com.graphql.spring.boot.test.GraphQLResponse; +import lombok.EqualsAndHashCode; import org.assertj.core.api.AbstractObjectAssert; +@EqualsAndHashCode(callSuper = true) public class GraphQLGenericObjectAssert extends AbstractObjectAssert, T> implements GraphQLResponseAssertion { diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLIntegerAssert.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLIntegerAssert.java index bc80221a..f0ef67f5 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLIntegerAssert.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLIntegerAssert.java @@ -1,8 +1,10 @@ package com.graphql.spring.boot.test.assertions; import com.graphql.spring.boot.test.GraphQLResponse; +import lombok.EqualsAndHashCode; import org.assertj.core.api.AbstractIntegerAssert; +@EqualsAndHashCode(callSuper = true) public class GraphQLIntegerAssert extends AbstractIntegerAssert implements GraphQLResponseAssertion { diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLListAssert.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLListAssert.java index c1e53f3d..7ed2e215 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLListAssert.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLListAssert.java @@ -2,10 +2,12 @@ import com.graphql.spring.boot.test.GraphQLResponse; import java.util.List; +import lombok.EqualsAndHashCode; import org.assertj.core.api.FactoryBasedNavigableListAssert; import org.assertj.core.api.ObjectAssert; import org.assertj.core.api.ObjectAssertFactory; +@EqualsAndHashCode(callSuper = true) public class GraphQLListAssert extends FactoryBasedNavigableListAssert< GraphQLListAssert, List, diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLLongAssert.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLLongAssert.java index 12316d85..24a599a4 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLLongAssert.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLLongAssert.java @@ -1,8 +1,10 @@ package com.graphql.spring.boot.test.assertions; import com.graphql.spring.boot.test.GraphQLResponse; +import lombok.EqualsAndHashCode; import org.assertj.core.api.AbstractLongAssert; +@EqualsAndHashCode(callSuper = true) public class GraphQLLongAssert extends AbstractLongAssert implements GraphQLResponseAssertion { diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLShortAssert.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLShortAssert.java index 373e698e..af9a3b5c 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLShortAssert.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLShortAssert.java @@ -1,8 +1,10 @@ package com.graphql.spring.boot.test.assertions; import com.graphql.spring.boot.test.GraphQLResponse; +import lombok.EqualsAndHashCode; import org.assertj.core.api.AbstractShortAssert; +@EqualsAndHashCode(callSuper = true) public class GraphQLShortAssert extends AbstractShortAssert implements GraphQLResponseAssertion { diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLStringAssert.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLStringAssert.java index 8643be46..7a3520c3 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLStringAssert.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/GraphQLStringAssert.java @@ -1,8 +1,10 @@ package com.graphql.spring.boot.test.assertions; import com.graphql.spring.boot.test.GraphQLResponse; +import lombok.EqualsAndHashCode; import org.assertj.core.api.AbstractStringAssert; +@EqualsAndHashCode(callSuper = true) public class GraphQLStringAssert extends AbstractStringAssert implements GraphQLResponseAssertion { diff --git a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/NumberOfErrorsAssertion.java b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/NumberOfErrorsAssertion.java index 24563c5e..93fc1d86 100644 --- a/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/NumberOfErrorsAssertion.java +++ b/graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test/assertions/NumberOfErrorsAssertion.java @@ -7,8 +7,10 @@ import com.graphql.spring.boot.test.GraphQLTestError; import com.jayway.jsonpath.PathNotFoundException; import java.util.List; +import lombok.EqualsAndHashCode; import org.assertj.core.api.AbstractIntegerAssert; +@EqualsAndHashCode(callSuper = true) public class NumberOfErrorsAssertion extends AbstractIntegerAssert implements GraphQLResponseAssertion { diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLAssertIsNotNullTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLAssertIsNotNullTest.java index 3dcedf1e..9c79ac39 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLAssertIsNotNullTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLAssertIsNotNullTest.java @@ -7,11 +7,12 @@ import com.graphql.spring.boot.test.assertions.GraphQLFieldAssert; import com.jayway.jsonpath.PathNotFoundException; +import lombok.EqualsAndHashCode; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLAssertIsNotNullTest extends GraphQLFieldAssertTestBase { +class GraphQLAssertIsNotNullTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should pass if the value at the provided path is not null.") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLAssertIsNotPresentOrNullTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLAssertIsNotPresentOrNullTest.java index 98e92a07..4a753451 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLAssertIsNotPresentOrNullTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLAssertIsNotPresentOrNullTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLAssertIsNotPresentOrNullTest extends GraphQLFieldAssertTestBase { +class GraphQLAssertIsNotPresentOrNullTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should pass if the provided path is not present.") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBigDecimalTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBigDecimalTest.java index 5a6c2c78..24d7b699 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBigDecimalTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBigDecimalTest.java @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertAsBigDecimalTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertAsBigDecimalTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should return a big decimal assertion (value at specific path is valid number).") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBigIntegerTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBigIntegerTest.java index 190d0e7a..b192bbf0 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBigIntegerTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBigIntegerTest.java @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertAsBigIntegerTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertAsBigIntegerTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should return a big integer assertion (value at specific path is valid number).") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBooleanTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBooleanTest.java index 4847908f..e7422633 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBooleanTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsBooleanTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertAsBooleanTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertAsBooleanTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should return a Boolean assertion (value at specific path is valid Boolean value).") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsByteTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsByteTest.java index 35b8969b..46836b6d 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsByteTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsByteTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertAsByteTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertAsByteTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should return a Byte assertion (value at specific path is valid Byte value).") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsIntegerTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsIntegerTest.java index 5847035e..1417d99c 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsIntegerTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsIntegerTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertAsIntegerTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertAsIntegerTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should return a Integer assertion (value at specific path is valid Integer value).") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsJavaListTypeTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsJavaListTypeTest.java index 4a926817..881072e3 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsJavaListTypeTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsJavaListTypeTest.java @@ -15,7 +15,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertAsJavaListTypeTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertAsJavaListTypeTest extends GraphQLFieldAssertTestBase { private static final JavaType STRING_LIST_TYPE = TypeFactory.defaultInstance() .constructCollectionLikeType(List.class, String.class); diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsLongTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsLongTest.java index 5364bb73..602aa2d4 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsLongTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsLongTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertAsLongTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertAsLongTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should return a long assertion (value at specific path is valid long value).") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsShortTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsShortTest.java index 57c53819..0281db7a 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsShortTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsShortTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertAsShortTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertAsShortTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should return a Short assertion (value at specific path is valid Short value).") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsStringTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsStringTest.java index 3350ec07..79f97aa5 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsStringTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsStringTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertAsStringTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertAsStringTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should return a String assertion (value at specific path is valid String value).") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsTest.java index 9f6cd49c..038f4d17 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertAsTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertAsTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertAsTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should return a generic assertion (value at specific path is non-null).") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertIsNotPresentTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertIsNotPresentTest.java index 363bb04b..c57b96ac 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertIsNotPresentTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertIsNotPresentTest.java @@ -13,7 +13,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class GraphQLFieldAssertIsNotPresentTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertIsNotPresentTest extends GraphQLFieldAssertTestBase { private static Stream valuesThatShouldCauseFailure() { return Stream.of(null, NON_NULL_VALUE); diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertIsNullTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertIsNullTest.java index f1eb2453..f0aa0146 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertIsNullTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLFieldAssertIsNullTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; -public class GraphQLFieldAssertIsNullTest extends GraphQLFieldAssertTestBase { +class GraphQLFieldAssertIsNullTest extends GraphQLFieldAssertTestBase { @Test @DisplayName("Should pass if the value at the provided path is null.") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLResponseTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLResponseTest.java index f6ab384a..a3404a04 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLResponseTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLResponseTest.java @@ -36,7 +36,7 @@ import org.springframework.util.StreamUtils; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class GraphQLResponseTest { +class GraphQLResponseTest { private static final String DATA_PATH_TEST = "$.data.test"; private static final String INNER_FOO_LIST_DATA_PATH = "$.data.externalList[*].fooList"; @@ -99,7 +99,7 @@ private static String loadClassPathResource(final String path) { @DisplayName("Should get the JSON node's value as a String.") @ParameterizedTest @MethodSource("testGetStringArguments") - public void testGetString(final String bodyString, final String expected) { + void testGetString(final String bodyString, final String expected) { //GIVEN final GraphQLResponse graphQLResponse = createResponse(bodyString); //WHEN @@ -111,7 +111,7 @@ public void testGetString(final String bodyString, final String expected) { @DisplayName("Should get the JSON node's value as an instance of a specified class.") @ParameterizedTest @MethodSource("testGetArguments") - public void testGet(final String bodyString, final Class clazz, final T expected) { + void testGet(final String bodyString, final Class clazz, final T expected) { //GIVEN final GraphQLResponse graphQLResponse = createResponse(bodyString); //WHEN @@ -123,7 +123,7 @@ public void testGet(final String bodyString, final Class clazz, final T e @DisplayName("Should get the JSON node's value as a List.") @ParameterizedTest @MethodSource("testGetListArguments") - public void testGetList(final String bodyString, final Class clazz, + void testGetList(final String bodyString, final Class clazz, final List expected) { //GIVEN final GraphQLResponse graphQLResponse = createResponse(bodyString); @@ -135,7 +135,7 @@ public void testGetList(final String bodyString, final Class clazz, @DisplayName("Should get field as defined by Jackson's JavaType.") @Test - public void testGetAsJavaType() { + void testGetAsJavaType() { // GIVEN final List> expected = Arrays.asList(Arrays.asList("foo1", "foo2"), Collections.singletonList("foo3")); @@ -155,7 +155,7 @@ public void testGetAsJavaType() { @DisplayName("Should throw illegal argument exception if type is incompatible") @Test - public void testGetAsJavaTypeConversionError() { + void testGetAsJavaTypeConversionError() { // GIVEN final JavaType stringType = objectMapper.getTypeFactory().constructType(String.class); // WHEN diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLSubscriptionTestAwaitNoAnswerTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLSubscriptionTestAwaitNoAnswerTest.java index 9c45ab00..b2eafdc2 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLSubscriptionTestAwaitNoAnswerTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLSubscriptionTestAwaitNoAnswerTest.java @@ -8,7 +8,7 @@ import org.junit.jupiter.params.provider.ValueSource; @DisplayName("Testing awaitNoResponse methods") -public class GraphQLSubscriptionTestAwaitNoAnswerTest extends GraphQLTestSubscriptionTestBase { +class GraphQLSubscriptionTestAwaitNoAnswerTest extends GraphQLTestSubscriptionTestBase { @Test @DisplayName("Should succeed if no responses arrived / default stopAfter.") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAwaitAndGetResponseTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAwaitAndGetResponseTest.java index a8c7cf28..bcc42c3b 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAwaitAndGetResponseTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionAwaitAndGetResponseTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -public class GraphQLTestSubscriptionAwaitAndGetResponseTest extends +class GraphQLTestSubscriptionAwaitAndGetResponseTest extends GraphQLTestSubscriptionTestBase { @Test diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionErrorTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionErrorTest.java index ad14be0e..c758eae5 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionErrorTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionErrorTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; @DisplayName("Test error message handling.") -public class GraphQLTestSubscriptionErrorTest extends GraphQLTestSubscriptionTestBase { +class GraphQLTestSubscriptionErrorTest extends GraphQLTestSubscriptionTestBase { @Test @DisplayName("Should handle error messages.") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionGetRemainingResponsesTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionGetRemainingResponsesTest.java index e6b31623..d027aaf6 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionGetRemainingResponsesTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionGetRemainingResponsesTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test; @DisplayName("Testing getRemainingResponses") -public class GraphQLTestSubscriptionGetRemainingResponsesTest extends +class GraphQLTestSubscriptionGetRemainingResponsesTest extends GraphQLTestSubscriptionTestBase { @Test diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionResetTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionResetTest.java index ecd1cfd0..6dc1e342 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionResetTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionResetTest.java @@ -7,7 +7,7 @@ import org.springframework.test.util.ReflectionTestUtils; @DisplayName("Testing reset") -public class GraphQLTestSubscriptionResetTest extends GraphQLTestSubscriptionTestBase { +class GraphQLTestSubscriptionResetTest extends GraphQLTestSubscriptionTestBase { @Test @DisplayName("Should work if subscription was not yet started.") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionUsageErrorHandlingTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionUsageErrorHandlingTest.java index 51ff09e1..4273f626 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionUsageErrorHandlingTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestSubscriptionUsageErrorHandlingTest.java @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test; @DisplayName("Testing if usage errors are properly handled.") -public class GraphQLTestSubscriptionUsageErrorHandlingTest extends GraphQLTestSubscriptionTestBase { +class GraphQLTestSubscriptionUsageErrorHandlingTest extends GraphQLTestSubscriptionTestBase { @Test @DisplayName("Should raise an assertion error if init is called after init.") diff --git a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateIntegrationTest.java b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateIntegrationTest.java index 6c702b49..d827da2e 100644 --- a/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateIntegrationTest.java +++ b/graphql-spring-boot-test/src/test/java/com/graphql/spring/boot/test/GraphQLTestTemplateIntegrationTest.java @@ -17,7 +17,7 @@ import org.springframework.http.HttpHeaders; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class GraphQLTestTemplateIntegrationTest { +class GraphQLTestTemplateIntegrationTest { private static final String SIMPLE_TEST_QUERY = "simple-test-query.graphql"; private static final String SIMPLE_TEST_QUERY_WITH_FRAGMENTS = "simple-test-query-with-fragments.graphql"; diff --git a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCSRFTest.java b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCSRFTest.java index 7fbf2223..c8a1f8fe 100644 --- a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCSRFTest.java +++ b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCSRFTest.java @@ -19,7 +19,7 @@ @ExtendWith(SpringExtension.class) @SpringBootTest(classes = PlaygroundTestConfig.class) @AutoConfigureMockMvc -public class PlaygroundCSRFTest { +class PlaygroundCSRFTest { private static final String CSRF_ATTRIBUTE_NAME = "_csrf"; @@ -30,7 +30,7 @@ public class PlaygroundCSRFTest { private ObjectMapper objectMapper; @Test - public void shouldLoadCSRFData() throws Exception { + void shouldLoadCSRFData() throws Exception { final MvcResult mvcResult = mockMvc.perform(get(PlaygroundTestHelper.DEFAULT_PLAYGROUND_ENDPOINT)) .andExpect(status().isOk()) .andExpect(model().attributeExists(CSRF_ATTRIBUTE_NAME)) diff --git a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCdnCustomVersionTest.java b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCdnCustomVersionTest.java index 2fcaff4a..42dba75f 100644 --- a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCdnCustomVersionTest.java +++ b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCdnCustomVersionTest.java @@ -11,19 +11,14 @@ @SpringBootTest(classes = PlaygroundTestConfig.class) @AutoConfigureMockMvc @TestPropertySource("classpath:application-playground-cdn-custom-version-test.properties") -public class PlaygroundCdnCustomVersionTest extends PlaygroundResourcesTestBase { +class PlaygroundCdnCustomVersionTest extends PlaygroundResourcesTestBase { - private final String CSS_CDN_PATH - = "https://cdn.jsdelivr.net/npm/graphql-playground-react@1.7.10/build/static/css/index.css"; - private final String SCRIPT_CDN_PATH - = "https://cdn.jsdelivr.net/npm/graphql-playground-react@1.7.10/build/static/js/middleware.js"; - private final String FAVICON_CDN_PATH - = "https://cdn.jsdelivr.net/npm/graphql-playground-react@1.7.10/build/favicon.png"; - private final String LOGO_CDN_PATH - = "https://cdn.jsdelivr.net/npm/graphql-playground-react@1.7.10/build/logo.png"; - - @Test - public void shouldLoadSpecifiedVersionFromCdn() throws Exception { - testPlaygroundResources(CSS_CDN_PATH, SCRIPT_CDN_PATH, FAVICON_CDN_PATH, LOGO_CDN_PATH); - } + @Test + void shouldLoadSpecifiedVersionFromCdn() throws Exception { + String LOGO_CDN_PATH = "https://cdn.jsdelivr.net/npm/graphql-playground-react@1.7.10/build/logo.png"; + String FAVICON_CDN_PATH = "https://cdn.jsdelivr.net/npm/graphql-playground-react@1.7.10/build/favicon.png"; + String SCRIPT_CDN_PATH = "https://cdn.jsdelivr.net/npm/graphql-playground-react@1.7.10/build/static/js/middleware.js"; + String CSS_CDN_PATH = "https://cdn.jsdelivr.net/npm/graphql-playground-react@1.7.10/build/static/css/index.css"; + testPlaygroundResources(CSS_CDN_PATH, SCRIPT_CDN_PATH, FAVICON_CDN_PATH, LOGO_CDN_PATH); + } } diff --git a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCdnTest.java b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCdnTest.java index 4148f0ec..1ee91efa 100644 --- a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCdnTest.java +++ b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCdnTest.java @@ -6,25 +6,19 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.junit4.SpringRunner; @ExtendWith(SpringExtension.class) @SpringBootTest(classes = PlaygroundTestConfig.class) @AutoConfigureMockMvc @TestPropertySource("classpath:application-playground-cdn-test.properties") -public class PlaygroundCdnTest extends PlaygroundResourcesTestBase { +class PlaygroundCdnTest extends PlaygroundResourcesTestBase { - private final String CSS_CDN_PATH - = "https://cdn.jsdelivr.net/npm/graphql-playground-react@latest/build/static/css/index.css"; - private final String SCRIPT_CDN_PATH - = "https://cdn.jsdelivr.net/npm/graphql-playground-react@latest/build/static/js/middleware.js"; - private final String FAVICON_CDN_PATH - = "https://cdn.jsdelivr.net/npm/graphql-playground-react@latest/build/favicon.png"; - private final String LOGO_CDN_PATH - = "https://cdn.jsdelivr.net/npm/graphql-playground-react@latest/build/logo.png"; - - @Test - public void shouldLoadLatestVersionFromCdn() throws Exception { - testPlaygroundResources(CSS_CDN_PATH, SCRIPT_CDN_PATH, FAVICON_CDN_PATH, LOGO_CDN_PATH); - } + @Test + void shouldLoadLatestVersionFromCdn() throws Exception { + String LOGO_CDN_PATH = "https://cdn.jsdelivr.net/npm/graphql-playground-react@latest/build/logo.png"; + String FAVICON_CDN_PATH = "https://cdn.jsdelivr.net/npm/graphql-playground-react@latest/build/favicon.png"; + String SCRIPT_CDN_PATH = "https://cdn.jsdelivr.net/npm/graphql-playground-react@latest/build/static/js/middleware.js"; + String CSS_CDN_PATH = "https://cdn.jsdelivr.net/npm/graphql-playground-react@latest/build/static/css/index.css"; + testPlaygroundResources(CSS_CDN_PATH, SCRIPT_CDN_PATH, FAVICON_CDN_PATH, LOGO_CDN_PATH); + } } diff --git a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomMappingTest.java b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomMappingTest.java index 6c7657a5..618bddf5 100644 --- a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomMappingTest.java +++ b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomMappingTest.java @@ -1,5 +1,12 @@ package graphql.kickstart.playground.boot; +import static org.hamcrest.Matchers.isEmptyString; +import static org.hamcrest.Matchers.not; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; @@ -10,31 +17,23 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; -import java.nio.charset.StandardCharsets; - -import static org.hamcrest.Matchers.isEmptyString; -import static org.hamcrest.Matchers.not; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - @ExtendWith(SpringExtension.class) @SpringBootTest(classes = PlaygroundTestConfig.class) @AutoConfigureMockMvc @TestPropertySource("classpath:application-playground-mapping-test.properties") -public class PlaygroundCustomMappingTest { +class PlaygroundCustomMappingTest { - private static final String CONFIGURED_MAPPING = "/test-mapping"; + private static final String CONFIGURED_MAPPING = "/test-mapping"; - @Autowired - private MockMvc mockMvc; + @Autowired + private MockMvc mockMvc; - @Test - public void shouldUseTheConfiguredRequestMapping() throws Exception { - mockMvc.perform(get(CONFIGURED_MAPPING)) - .andExpect(status().isOk()) - .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML)) - .andExpect(content().encoding(StandardCharsets.UTF_8.name())) - .andExpect(content().string(not(isEmptyString()))); - } + @Test + void shouldUseTheConfiguredRequestMapping() throws Exception { + mockMvc.perform(get(CONFIGURED_MAPPING)) + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML)) + .andExpect(content().encoding(StandardCharsets.UTF_8.name())) + .andExpect(content().string(not(isEmptyString()))); + } } diff --git a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomStaticPathTest.java b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomStaticPathTest.java index 7140fe03..a4ef063c 100644 --- a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomStaticPathTest.java +++ b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomStaticPathTest.java @@ -6,21 +6,20 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.junit4.SpringRunner; @ExtendWith(SpringExtension.class) @SpringBootTest(classes = PlaygroundTestConfig.class) @AutoConfigureMockMvc @TestPropertySource("classpath:application-playground-custom-static-path.properties") -public class PlaygroundCustomStaticPathTest extends PlaygroundResourcesTestBase { +class PlaygroundCustomStaticPathTest extends PlaygroundResourcesTestBase { - private static final String CUSTOM_CSS_URL = "/custom-static-path/static/css/index.css"; - private static final String CUSTOM_SCRIPT_URL = "/custom-static-path/static/js/middleware.js"; - private static final String CUSTOM_FAVICON_URL = "/custom-static-path/favicon.png"; - private static final String CUSTOM_LOGO_URL = "/custom-static-path/logo.png"; + private static final String CUSTOM_CSS_URL = "/custom-static-path/static/css/index.css"; + private static final String CUSTOM_SCRIPT_URL = "/custom-static-path/static/js/middleware.js"; + private static final String CUSTOM_FAVICON_URL = "/custom-static-path/favicon.png"; + private static final String CUSTOM_LOGO_URL = "/custom-static-path/logo.png"; - @Test - public void shouldLoadStaticResourcesFromCustomPath() throws Exception { - testPlaygroundResources(CUSTOM_CSS_URL, CUSTOM_SCRIPT_URL, CUSTOM_FAVICON_URL, CUSTOM_LOGO_URL); - } + @Test + void shouldLoadStaticResourcesFromCustomPath() throws Exception { + testPlaygroundResources(CUSTOM_CSS_URL, CUSTOM_SCRIPT_URL, CUSTOM_FAVICON_URL, CUSTOM_LOGO_URL); + } } diff --git a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomTitleTest.java b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomTitleTest.java index f7060c05..54f081e0 100644 --- a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomTitleTest.java +++ b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundCustomTitleTest.java @@ -1,5 +1,9 @@ package graphql.kickstart.playground.boot; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.junit.jupiter.api.Test; @@ -12,29 +16,26 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - @ExtendWith(SpringExtension.class) @SpringBootTest(classes = PlaygroundTestConfig.class) @AutoConfigureMockMvc @TestPropertySource("classpath:application-playground-custom-title.properties") -public class PlaygroundCustomTitleTest { +class PlaygroundCustomTitleTest { - private static final String CUSTOM_TITLE = "My CustomTest Title"; + private static final String CUSTOM_TITLE = "My CustomTest Title"; - @Autowired - private MockMvc mockMvc; + @Autowired + private MockMvc mockMvc; - @Test - public void shouldUseTheCustomPageTitle() throws Exception { - final MvcResult mvcResult = mockMvc.perform(get(PlaygroundTestHelper.DEFAULT_PLAYGROUND_ENDPOINT)) - .andExpect(status().isOk()) - .andExpect(model().attribute(PlaygroundTestHelper.PAGE_TITLE_FIELD_NAME, CUSTOM_TITLE)) - .andReturn(); + @Test + void shouldUseTheCustomPageTitle() throws Exception { + final MvcResult mvcResult = mockMvc + .perform(get(PlaygroundTestHelper.DEFAULT_PLAYGROUND_ENDPOINT)) + .andExpect(status().isOk()) + .andExpect(model().attribute(PlaygroundTestHelper.PAGE_TITLE_FIELD_NAME, CUSTOM_TITLE)) + .andReturn(); - final Document document = Jsoup.parse(mvcResult.getResponse().getContentAsString()); - PlaygroundTestHelper.assertTitle(document, CUSTOM_TITLE); - } + final Document document = Jsoup.parse(mvcResult.getResponse().getContentAsString()); + PlaygroundTestHelper.assertTitle(document, CUSTOM_TITLE); + } } diff --git a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundDisabledTest.java b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundDisabledTest.java index 290ac107..a60bc831 100644 --- a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundDisabledTest.java +++ b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundDisabledTest.java @@ -1,5 +1,9 @@ package graphql.kickstart.playground.boot; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; @@ -10,29 +14,26 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; -import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - @ExtendWith(SpringExtension.class) @SpringBootTest(classes = PlaygroundTestConfig.class, properties = "graphql.playground.enabled=false") @AutoConfigureMockMvc -public class PlaygroundDisabledTest { +class PlaygroundDisabledTest { - @Autowired - private ApplicationContext applicationContext; + @Autowired + private ApplicationContext applicationContext; - @Autowired - private MockMvc mockMvc; + @Autowired + private MockMvc mockMvc; - @Test - public void playgroundShouldNotLoadIfDisabled() { - assertThatExceptionOfType(NoSuchBeanDefinitionException.class) - .isThrownBy(() -> applicationContext.getBean(PlaygroundController.class)); - } + @Test + void playgroundShouldNotLoadIfDisabled() { + assertThatExceptionOfType(NoSuchBeanDefinitionException.class) + .isThrownBy(() -> applicationContext.getBean(PlaygroundController.class)); + } - @Test - public void playgroundEndpointShouldNotExist() throws Exception { - mockMvc.perform(get(PlaygroundTestHelper.DEFAULT_PLAYGROUND_ENDPOINT)).andExpect(status().isNotFound()); - } + @Test + void playgroundEndpointShouldNotExist() throws Exception { + mockMvc.perform(get(PlaygroundTestHelper.DEFAULT_PLAYGROUND_ENDPOINT)) + .andExpect(status().isNotFound()); + } } diff --git a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundEnabledTest.java b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundEnabledTest.java index ef9d02b5..d4c24989 100644 --- a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundEnabledTest.java +++ b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundEnabledTest.java @@ -1,5 +1,14 @@ package graphql.kickstart.playground.boot; +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.emptyString; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + import com.fasterxml.jackson.databind.ObjectMapper; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; @@ -14,87 +23,82 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; -import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.emptyString; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - @ExtendWith(SpringExtension.class) @SpringBootTest(classes = PlaygroundTestConfig.class) @AutoConfigureMockMvc -public class PlaygroundEnabledTest { +class PlaygroundEnabledTest { - private static final String DEFAULT_CSS_PATH = "/vendor/playground/static/css/index.css"; - private static final String DEFAULT_SCRIPT_PATH = "/vendor/playground/static/js/middleware.js"; - private static final String DEFAULT_FAVICON_PATH = "/vendor/playground/favicon.png"; - private static final String DEFAULT_LOGO_PATH = "/vendor/playground/logo.png"; - private static final String DEFAULT_TITLE = "Playground"; + private static final String DEFAULT_CSS_PATH = "/vendor/playground/static/css/index.css"; + private static final String DEFAULT_SCRIPT_PATH = "/vendor/playground/static/js/middleware.js"; + private static final String DEFAULT_FAVICON_PATH = "/vendor/playground/favicon.png"; + private static final String DEFAULT_LOGO_PATH = "/vendor/playground/logo.png"; + private static final String DEFAULT_TITLE = "Playground"; - @Autowired - private ApplicationContext applicationContext; + @Autowired + private ApplicationContext applicationContext; - @Autowired - private MockMvc mockMvc; + @Autowired + private MockMvc mockMvc; - @Autowired - private ObjectMapper objectMapper; + @Autowired + private ObjectMapper objectMapper; - @Test - public void playgroundLoads() { - assertThat(applicationContext.getBean(PlaygroundController.class)).isNotNull(); - } + @Test + void playgroundLoads() { + assertThat(applicationContext.getBean(PlaygroundController.class)).isNotNull(); + } - @Test - public void playgroundShouldBeAvailableAtDefaultEndpoint() throws Exception { - final MvcResult mvcResult = mockMvc.perform(get(PlaygroundTestHelper.DEFAULT_PLAYGROUND_ENDPOINT)) - .andExpect(status().isOk()) - .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML)) - .andExpect(content().string(not(is(emptyString())))) - .andExpect(model().attribute(PlaygroundTestHelper.PAGE_TITLE_FIELD_NAME, DEFAULT_TITLE)) - .andExpect(model().attribute(PlaygroundTestHelper.CSS_URL_FIELD_NAME, DEFAULT_CSS_PATH)) - .andExpect(model().attribute(PlaygroundTestHelper.SCRIPT_URL_FIELD_NAME, DEFAULT_SCRIPT_PATH)) - .andExpect(model().attribute(PlaygroundTestHelper.FAVICON_URL_FIELD_NAME, DEFAULT_FAVICON_PATH)) - .andExpect(model().attribute(PlaygroundTestHelper.LOGO_URL_FIELD_NAME, DEFAULT_LOGO_PATH)) - .andReturn(); + @Test + void playgroundShouldBeAvailableAtDefaultEndpoint() throws Exception { + final MvcResult mvcResult = mockMvc + .perform(get(PlaygroundTestHelper.DEFAULT_PLAYGROUND_ENDPOINT)) + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML)) + .andExpect(content().string(not(is(emptyString())))) + .andExpect(model().attribute(PlaygroundTestHelper.PAGE_TITLE_FIELD_NAME, DEFAULT_TITLE)) + .andExpect(model().attribute(PlaygroundTestHelper.CSS_URL_FIELD_NAME, DEFAULT_CSS_PATH)) + .andExpect( + model().attribute(PlaygroundTestHelper.SCRIPT_URL_FIELD_NAME, DEFAULT_SCRIPT_PATH)) + .andExpect( + model().attribute(PlaygroundTestHelper.FAVICON_URL_FIELD_NAME, DEFAULT_FAVICON_PATH)) + .andExpect(model().attribute(PlaygroundTestHelper.LOGO_URL_FIELD_NAME, DEFAULT_LOGO_PATH)) + .andReturn(); - final Document document = Jsoup.parse(mvcResult.getResponse().getContentAsString()); - PlaygroundTestHelper.assertTitle(document, DEFAULT_TITLE); - PlaygroundTestHelper.assertStaticResources(document, DEFAULT_CSS_PATH, DEFAULT_SCRIPT_PATH, DEFAULT_FAVICON_PATH, DEFAULT_LOGO_PATH); - } + final Document document = Jsoup.parse(mvcResult.getResponse().getContentAsString()); + PlaygroundTestHelper.assertTitle(document, DEFAULT_TITLE); + PlaygroundTestHelper.assertStaticResources(document, DEFAULT_CSS_PATH, DEFAULT_SCRIPT_PATH, + DEFAULT_FAVICON_PATH, DEFAULT_LOGO_PATH); + } - @Test - public void defaultCssShouldBeAvailable() throws Exception { - mockMvc.perform(get(DEFAULT_CSS_PATH)) - .andExpect(status().isOk()) - .andExpect(content().string(not(is(emptyString())))) - .andExpect(content().contentTypeCompatibleWith("text/css")); - } + @Test + void defaultCssShouldBeAvailable() throws Exception { + mockMvc.perform(get(DEFAULT_CSS_PATH)) + .andExpect(status().isOk()) + .andExpect(content().string(not(is(emptyString())))) + .andExpect(content().contentTypeCompatibleWith("text/css")); + } - @Test - public void defaultScriptShouldBeAvailable() throws Exception { - mockMvc.perform(get(DEFAULT_SCRIPT_PATH)) - .andExpect(status().isOk()) - .andExpect(content().string(not(is(emptyString())))) - .andExpect(content().contentTypeCompatibleWith("application/javascript")); - } + @Test + void defaultScriptShouldBeAvailable() throws Exception { + mockMvc.perform(get(DEFAULT_SCRIPT_PATH)) + .andExpect(status().isOk()) + .andExpect(content().string(not(is(emptyString())))) + .andExpect(content().contentTypeCompatibleWith("application/javascript")); + } - @Test - public void defaultFaviconShouldBeAvailable() throws Exception { - mockMvc.perform(get(DEFAULT_FAVICON_PATH)) - .andExpect(status().isOk()) - .andExpect(content().string(not(is(emptyString())))) - .andExpect(content().contentTypeCompatibleWith("image/png")); - } + @Test + void defaultFaviconShouldBeAvailable() throws Exception { + mockMvc.perform(get(DEFAULT_FAVICON_PATH)) + .andExpect(status().isOk()) + .andExpect(content().string(not(is(emptyString())))) + .andExpect(content().contentTypeCompatibleWith("image/png")); + } - @Test - public void defaultLogoShouldBeAvailable() throws Exception { - mockMvc.perform(get(DEFAULT_LOGO_PATH)) - .andExpect(status().isOk()) - .andExpect(content().string(not(is(emptyString())))) - .andExpect(content().contentTypeCompatibleWith("image/png")); - } + @Test + void defaultLogoShouldBeAvailable() throws Exception { + mockMvc.perform(get(DEFAULT_LOGO_PATH)) + .andExpect(status().isOk()) + .andExpect(content().string(not(is(emptyString())))) + .andExpect(content().contentTypeCompatibleWith("image/png")); + } } diff --git a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundSettingsTest.java b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundSettingsTest.java index be062498..cb419d32 100644 --- a/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundSettingsTest.java +++ b/playground-spring-boot-autoconfigure/src/test/java/graphql/kickstart/playground/boot/PlaygroundSettingsTest.java @@ -1,5 +1,9 @@ package graphql.kickstart.playground.boot; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -10,67 +14,62 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - @ExtendWith(SpringExtension.class) @SpringBootTest(classes = PlaygroundTestConfig.class) @AutoConfigureMockMvc @TestPropertySource("classpath:application-playground-settings-test.properties") -public class PlaygroundSettingsTest { +class PlaygroundSettingsTest { - @Autowired - private MockMvc mockMvc; + @Autowired + private MockMvc mockMvc; - @Autowired - private ObjectMapper objectMapper; + @Autowired + private ObjectMapper objectMapper; - @Test - public void shouldProperlyLoadSettings() throws Exception { + @Test + void shouldProperlyLoadSettings() throws Exception { - final ArrayNode tabs = objectMapper.createArrayNode(); - final ArrayNode tabResponses = objectMapper.createArrayNode(); - tabResponses.add("{\"response\":\"data\"}"); - final ObjectNode tabHeaders = objectMapper.createObjectNode(); - tabHeaders.put("tabHeader", "custom value"); - final ObjectNode tab = objectMapper.createObjectNode(); - tab.put("endpoint", "/tab-endpoint"); - tab.put("query", "query {}"); - tab.put("name", "Test Tab"); - tab.put("variables", "{\"test\":\"Test Value\"}"); - tab.set("responses", tabResponses); - tab.set("headers", tabHeaders); - tabs.add(tab); - final ObjectNode settings = objectMapper.createObjectNode(); - settings.put("editor.cursorShape", "underline"); - settings.put("editor.fontFamily", "monospace"); - settings.put("editor.fontSize", 14); - settings.put("editor.reuseHeaders", true); - settings.put("editor.theme", "dark"); - settings.put("prettier.printWidth", 80); - settings.put("prettier.tabWidth", 2); - settings.put("prettier.useTabs", false); - settings.put("request.credentials", "same-origin"); - settings.put("schema.polling.enable", true); - settings.put("schema.polling.endpointFilter", "*"); - settings.put("schema.polling.interval", 4000); - settings.put("schema.disableComments", true); - settings.put("tracing.hideTracingResponse", true); - final ObjectNode headers = objectMapper.createObjectNode(); - headers.put("test", "test-header-value"); - final ObjectNode expectedNode = objectMapper.createObjectNode(); - expectedNode.put("endpoint", "/test-endpoint"); - expectedNode.put("subscriptionEndpoint", "/test-subscription-endpoint"); - expectedNode.set("settings", settings); - expectedNode.set("headers", headers); - expectedNode.set("tabs", tabs); + final ArrayNode tabs = objectMapper.createArrayNode(); + final ArrayNode tabResponses = objectMapper.createArrayNode(); + tabResponses.add("{\"response\":\"data\"}"); + final ObjectNode tabHeaders = objectMapper.createObjectNode(); + tabHeaders.put("tabHeader", "custom value"); + final ObjectNode tab = objectMapper.createObjectNode(); + tab.put("endpoint", "/tab-endpoint"); + tab.put("query", "query {}"); + tab.put("name", "Test Tab"); + tab.put("variables", "{\"test\":\"Test Value\"}"); + tab.set("responses", tabResponses); + tab.set("headers", tabHeaders); + tabs.add(tab); + final ObjectNode settings = objectMapper.createObjectNode(); + settings.put("editor.cursorShape", "underline"); + settings.put("editor.fontFamily", "monospace"); + settings.put("editor.fontSize", 14); + settings.put("editor.reuseHeaders", true); + settings.put("editor.theme", "dark"); + settings.put("prettier.printWidth", 80); + settings.put("prettier.tabWidth", 2); + settings.put("prettier.useTabs", false); + settings.put("request.credentials", "same-origin"); + settings.put("schema.polling.enable", true); + settings.put("schema.polling.endpointFilter", "*"); + settings.put("schema.polling.interval", 4000); + settings.put("schema.disableComments", true); + settings.put("tracing.hideTracingResponse", true); + final ObjectNode headers = objectMapper.createObjectNode(); + headers.put("test", "test-header-value"); + final ObjectNode expectedNode = objectMapper.createObjectNode(); + expectedNode.put("endpoint", "/test-endpoint"); + expectedNode.put("subscriptionEndpoint", "/test-subscription-endpoint"); + expectedNode.set("settings", settings); + expectedNode.set("headers", headers); + expectedNode.set("tabs", tabs); - mockMvc.perform(get(PlaygroundTestHelper.DEFAULT_PLAYGROUND_ENDPOINT)) - .andExpect(status().isOk()) - .andExpect(model().attribute("properties", expectedNode)); - } + mockMvc.perform(get(PlaygroundTestHelper.DEFAULT_PLAYGROUND_ENDPOINT)) + .andExpect(status().isOk()) + .andExpect(model().attribute("properties", expectedNode)); + } } diff --git a/voyager-spring-boot-autoconfigure/src/main/java/graphql/kickstart/voyager/boot/VoyagerIndexHtmlTemplate.java b/voyager-spring-boot-autoconfigure/src/main/java/graphql/kickstart/voyager/boot/VoyagerIndexHtmlTemplate.java index 8d9d355b..9b6b4656 100644 --- a/voyager-spring-boot-autoconfigure/src/main/java/graphql/kickstart/voyager/boot/VoyagerIndexHtmlTemplate.java +++ b/voyager-spring-boot-autoconfigure/src/main/java/graphql/kickstart/voyager/boot/VoyagerIndexHtmlTemplate.java @@ -31,7 +31,7 @@ public class VoyagerIndexHtmlTemplate { private String staticBasePath; @Value("${voyager.cdn.enabled:false}") - private Boolean voyagerCdnEnabled; + private boolean voyagerCdnEnabled; @Value("${voyager.cdn.version:1.0.0-rc.26}") private String voyagerCdnVersion; @@ -55,11 +55,11 @@ public String fillIndexTemplate(String contextPath, Map params) replacements.put("reactDomJsUrl", getResourceUrl(staticBasePath, "react-dom.min.js", joinCdnjsPath("react-dom", "16.8.3", "umd/react-dom.production.min.js"))); replacements.put("voyagerCssUrl", getResourceUrl(staticBasePath, "voyager.css", - joinJsDelivrPath(VOYAGER, voyagerCdnVersion, "dist/voyager.css"))); + joinJsDelivrPath(voyagerCdnVersion, "dist/voyager.css"))); replacements.put("voyagerJsUrl", getResourceUrl(staticBasePath, "voyager.min.js", - joinJsDelivrPath(VOYAGER, voyagerCdnVersion, "dist/voyager.min.js"))); + joinJsDelivrPath(voyagerCdnVersion, "dist/voyager.min.js"))); replacements.put("voyagerWorkerJsUrl", getResourceUrl(staticBasePath, "voyager.worker.js", - joinJsDelivrPath(VOYAGER, voyagerCdnVersion, "dist/voyager.worker.min.js"))); + joinJsDelivrPath(voyagerCdnVersion, "dist/voyager.worker.min.js"))); replacements.put("contextPath", contextPath); return StringSubstitutor.replace(template, replacements); @@ -92,7 +92,7 @@ private String joinCdnjsPath(String library, String cdnVersion, String cdnFileNa return CDNJS_CLOUDFLARE_COM_AJAX_LIBS + library + "/" + cdnVersion + "/" + cdnFileName; } - private String joinJsDelivrPath(String library, String cdnVersion, String cdnFileName) { - return CDN_JSDELIVR_NET_NPM + library + "@" + cdnVersion + "/" + cdnFileName; + private String joinJsDelivrPath(String cdnVersion, String cdnFileName) { + return CDN_JSDELIVR_NET_NPM + VoyagerIndexHtmlTemplate.VOYAGER + "@" + cdnVersion + "/" + cdnFileName; } } diff --git a/voyager-spring-boot-autoconfigure/src/test/java/graphql/kickstart/voyager/boot/test/ReactiveVoyagerControllerTest.java b/voyager-spring-boot-autoconfigure/src/test/java/graphql/kickstart/voyager/boot/test/ReactiveVoyagerControllerTest.java index c6389af8..6618c925 100644 --- a/voyager-spring-boot-autoconfigure/src/test/java/graphql/kickstart/voyager/boot/test/ReactiveVoyagerControllerTest.java +++ b/voyager-spring-boot-autoconfigure/src/test/java/graphql/kickstart/voyager/boot/test/ReactiveVoyagerControllerTest.java @@ -11,12 +11,13 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; +import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; /** * @author Max Günther */ -public class ReactiveVoyagerControllerTest extends AbstractAutoConfigurationTest { +class ReactiveVoyagerControllerTest extends AbstractAutoConfigurationTest { public ReactiveVoyagerControllerTest() { super(AnnotationConfigReactiveWebApplicationContext.class, @@ -24,18 +25,19 @@ public ReactiveVoyagerControllerTest() { } @Test - public void voyagerLoads() { + void voyagerLoads() { load(EnabledConfiguration.class); assertThat(this.getContext().getBean(ReactiveVoyagerController.class)).isNotNull(); } @Test - public void voyagerDoesNotLoad() { + void voyagerDoesNotLoad() { load(DisabledConfiguration.class); + AbstractApplicationContext context = getContext(); assertThatExceptionOfType(NoSuchBeanDefinitionException.class) - .isThrownBy(() -> this.getContext().getBean(ReactiveVoyagerController.class)); + .isThrownBy(() -> context.getBean(ReactiveVoyagerController.class)); } @Configuration diff --git a/voyager-spring-boot-autoconfigure/src/test/java/graphql/kickstart/voyager/boot/test/VoyagerControllerTest.java b/voyager-spring-boot-autoconfigure/src/test/java/graphql/kickstart/voyager/boot/test/VoyagerControllerTest.java index 41d23aae..6fc5e23b 100644 --- a/voyager-spring-boot-autoconfigure/src/test/java/graphql/kickstart/voyager/boot/test/VoyagerControllerTest.java +++ b/voyager-spring-boot-autoconfigure/src/test/java/graphql/kickstart/voyager/boot/test/VoyagerControllerTest.java @@ -10,31 +10,33 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; +import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; /** * @author Andrew Potter */ -public class VoyagerControllerTest extends AbstractAutoConfigurationTest { +class VoyagerControllerTest extends AbstractAutoConfigurationTest { public VoyagerControllerTest() { super(AnnotationConfigWebApplicationContext.class, VoyagerAutoConfiguration.class); } @Test - public void graphiqlLoads() { + void graphiqlLoads() { load(EnabledConfiguration.class); assertThat(this.getContext().getBean(VoyagerController.class)).isNotNull(); } @Test - public void graphiqlDoesNotLoad() { + void graphiqlDoesNotLoad() { load(DisabledConfiguration.class); + AbstractApplicationContext context = getContext(); assertThatExceptionOfType(NoSuchBeanDefinitionException.class) - .isThrownBy(() -> this.getContext().getBean(VoyagerController.class)); + .isThrownBy(() -> context.getBean(VoyagerController.class)); } @Configuration