Skip to content

Commit

Permalink
#763: fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanStrehlerCGI committed Nov 2, 2023
1 parent da1366f commit c740ce1
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 103 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package de.muenchen.oss.digiwf.gateway.annotations;

import de.muenchen.oss.digiwf.gateway.ApiGatewayApplication;
import de.muenchen.oss.digiwf.gateway.TestConstants;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = { ApiGatewayApplication.class },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
@ActiveProfiles(TestConstants.SPRING_TEST_PROFILE)
@AutoConfigureObservability
public @interface ApiGatewayTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,13 @@
*/
package de.muenchen.oss.digiwf.gateway.controller;

import de.muenchen.oss.digiwf.gateway.ApiGatewayApplication;
import de.muenchen.oss.digiwf.gateway.annotations.ApiGatewayTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.reactive.server.WebTestClient;

import static de.muenchen.oss.digiwf.gateway.TestConstants.SPRING_TEST_PROFILE;


@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = {ApiGatewayApplication.class},
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
@ActiveProfiles(SPRING_TEST_PROFILE)
@ApiGatewayTest
public class ActuatorInfoEndpointTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,15 @@
*/
package de.muenchen.oss.digiwf.gateway.controller;

import de.muenchen.oss.digiwf.gateway.ApiGatewayApplication;
import de.muenchen.oss.digiwf.gateway.annotations.ApiGatewayTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.reactive.server.WebTestClient;

import static de.muenchen.oss.digiwf.gateway.TestConstants.SPRING_TEST_PROFILE;


@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = {ApiGatewayApplication.class},
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
@ActiveProfiles(SPRING_TEST_PROFILE)
@ApiGatewayTest
class PingControllerTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,14 @@
*/
package de.muenchen.oss.digiwf.gateway.filter;

import de.muenchen.oss.digiwf.gateway.ApiGatewayApplication;
import de.muenchen.oss.digiwf.gateway.TestConstants;
import de.muenchen.oss.digiwf.gateway.annotations.ApiGatewayTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.reactive.server.WebTestClient;


@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = { ApiGatewayApplication.class },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
@ActiveProfiles(TestConstants.SPRING_TEST_PROFILE)

@ApiGatewayTest
class CsrfTokenAppendingHelperFilterTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,21 @@
*/
package de.muenchen.oss.digiwf.gateway.filter;

import de.muenchen.oss.digiwf.gateway.ApiGatewayApplication;
import de.muenchen.oss.digiwf.gateway.TestConstants;
import com.github.tomakehurst.wiremock.http.HttpHeader;
import com.github.tomakehurst.wiremock.http.HttpHeaders;
import de.muenchen.oss.digiwf.gateway.annotations.ApiGatewayTest;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.http.HttpStatus;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.reactive.server.WebTestClient;

import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.*;


@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = {ApiGatewayApplication.class},
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
@ActiveProfiles(TestConstants.SPRING_TEST_PROFILE)
@ApiGatewayTest
@AutoConfigureWireMock
class GlobalAuthenticationErrorFilterTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,21 @@
*/
package de.muenchen.oss.digiwf.gateway.filter;

import de.muenchen.oss.digiwf.gateway.ApiGatewayApplication;
import com.github.tomakehurst.wiremock.http.HttpHeader;
import com.github.tomakehurst.wiremock.http.HttpHeaders;
import de.muenchen.oss.digiwf.gateway.TestConstants;
import de.muenchen.oss.digiwf.gateway.annotations.ApiGatewayTest;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.http.HttpStatus;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.reactive.server.WebTestClient;

import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.*;


@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = { ApiGatewayApplication.class },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
@ActiveProfiles(TestConstants.SPRING_TEST_PROFILE)
@ApiGatewayTest
@AutoConfigureWireMock
class GlobalBackendErrorFilterTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,19 @@
*/
package de.muenchen.oss.digiwf.gateway.filter;

import de.muenchen.oss.digiwf.gateway.ApiGatewayApplication;
import de.muenchen.oss.digiwf.gateway.TestConstants;
import de.muenchen.oss.digiwf.gateway.annotations.ApiGatewayTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.reactive.server.WebTestClient;

import static org.junit.jupiter.api.Assertions.assertTrue;

import java.nio.charset.StandardCharsets;

import static org.junit.jupiter.api.Assertions.assertTrue;


@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = { ApiGatewayApplication.class },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
@ActiveProfiles(TestConstants.SPRING_TEST_PROFILE)
@ApiGatewayTest
class GlobalRequestParameterPollutionFilterTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,19 @@
import com.github.tomakehurst.wiremock.http.HttpHeader;
import com.github.tomakehurst.wiremock.http.HttpHeaders;
import com.github.tomakehurst.wiremock.matching.EqualToPattern;
import de.muenchen.oss.digiwf.gateway.ApiGatewayApplication;
import de.muenchen.oss.digiwf.gateway.TestConstants;
import de.muenchen.oss.digiwf.gateway.annotations.ApiGatewayTest;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.http.HttpStatus;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.reactive.server.WebTestClient;

import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.verify;
import static com.github.tomakehurst.wiremock.client.WireMock.*;


@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = { ApiGatewayApplication.class },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
@ActiveProfiles(TestConstants.SPRING_TEST_PROFILE)
@ApiGatewayTest
@AutoConfigureWireMock
class BackendRouteTest {

Expand Down

0 comments on commit c740ce1

Please sign in to comment.