Skip to content

Commit

Permalink
Fix sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
oliemansm committed Dec 20, 2020
1 parent 3ae1db5 commit 7977f8e
Show file tree
Hide file tree
Showing 52 changed files with 286 additions and 264 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -377,7 +378,7 @@ public List<GraphQLResponse> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private RequestFactory() {
}

static HttpEntity<Object> forJson(String json, HttpHeaders headers) {
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers.setContentType(MediaType.APPLICATION_JSON);
return new HttpEntity<>(json, headers);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<GraphQLBigDecimalAssert>
implements GraphQLResponseAssertion {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<GraphQLBigIntegerAssert>
implements GraphQLResponseAssertion {

Expand Down
Original file line number Diff line number Diff line change
@@ -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<GraphQLBooleanAssert>
implements GraphQLResponseAssertion {

Expand Down
Original file line number Diff line number Diff line change
@@ -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<GraphQLByteAssert>
implements GraphQLResponseAssertion {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends GraphQLError>,
Expand Down
Original file line number Diff line number Diff line change
@@ -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<T>
extends AbstractObjectAssert<GraphQLGenericObjectAssert<T>, T>
implements GraphQLResponseAssertion {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<GraphQLIntegerAssert>
implements GraphQLResponseAssertion {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> extends FactoryBasedNavigableListAssert<
GraphQLListAssert<T>,
List<? extends T>,
Expand Down
Original file line number Diff line number Diff line change
@@ -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<GraphQLLongAssert>
implements GraphQLResponseAssertion {

Expand Down
Original file line number Diff line number Diff line change
@@ -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<GraphQLShortAssert>
implements GraphQLResponseAssertion {

Expand Down
Original file line number Diff line number Diff line change
@@ -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<GraphQLStringAssert>
implements GraphQLResponseAssertion {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<NumberOfErrorsAssertion>
implements GraphQLResponseAssertion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> valuesThatShouldCauseFailure() {
return Stream.of(null, NON_NULL_VALUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand All @@ -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 <T> void testGet(final String bodyString, final Class<T> clazz, final T expected) {
<T> void testGet(final String bodyString, final Class<T> clazz, final T expected) {
//GIVEN
final GraphQLResponse graphQLResponse = createResponse(bodyString);
//WHEN
Expand All @@ -123,7 +123,7 @@ public <T> void testGet(final String bodyString, final Class<T> clazz, final T e
@DisplayName("Should get the JSON node's value as a List.")
@ParameterizedTest
@MethodSource("testGetListArguments")
public <T> void testGetList(final String bodyString, final Class<T> clazz,
<T> void testGetList(final String bodyString, final Class<T> clazz,
final List<T> expected) {
//GIVEN
final GraphQLResponse graphQLResponse = createResponse(bodyString);
Expand All @@ -135,7 +135,7 @@ public <T> void testGetList(final String bodyString, final Class<T> clazz,

@DisplayName("Should get field as defined by Jackson's JavaType.")
@Test
public void testGetAsJavaType() {
void testGetAsJavaType() {
// GIVEN
final List<List<String>> expected = Arrays.asList(Arrays.asList("foo1", "foo2"),
Collections.singletonList("foo3"));
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
Loading

0 comments on commit 7977f8e

Please sign in to comment.