Skip to content

Commit

Permalink
GMS-85 Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-szrnka committed Dec 20, 2023
1 parent 47b8801 commit 7a3eec8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package io.github.gms.common.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.ZonedDateTime;

import static io.github.gms.common.util.Constants.DATE_FORMAT;

/**
* @author Peter Szrnka
* @since 1.0
Expand All @@ -14,10 +18,12 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ErrorResponseDto implements Serializable {

@Serial
private static final long serialVersionUID = 6418018474049813605L;

private String correlationId;
private String message;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DATE_FORMAT)
private ZonedDateTime timestamp;

public ErrorResponseDto(String message, String correlationId, ZonedDateTime timestamp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import io.github.gms.common.exception.GmsException;
import org.jboss.logging.MDC;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpStatus;
Expand All @@ -29,7 +28,6 @@
* @author Peter Szrnka
* @since 1.0
*/
@Disabled
class GmsExceptionHandlerTest extends AbstractUnitTest {

private static final String CORRELATION_ID = "CORRELATION_ID";
Expand Down Expand Up @@ -101,7 +99,7 @@ void shouldHandleMissingRequestHeaderException() {
WebRequest webRequest = mock(WebRequest.class);

// act
ResponseEntity<ErrorResponseDto> response = handler.handleOtherException(new MissingRequestHeaderException("x-api-key", mockMethodParameter), webRequest);
ResponseEntity<ErrorResponseDto> response = handler.handleMissingRequestHeaderException(new MissingRequestHeaderException("x-api-key", mockMethodParameter), webRequest);

// assert
assertNotNull(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
Expand All @@ -13,6 +14,7 @@
*/
@Slf4j
@Configuration
@ComponentScan(basePackages = "io.github.gms")
public class TestApplicationConfig {

@Bean
Expand Down

0 comments on commit 7a3eec8

Please sign in to comment.