Skip to content

Commit e6ed485

Browse files
committed
fix(core): fix MessageDto after rebase
1 parent 89479f1 commit e6ed485

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

springwolf-core/src/main/java/io/github/springwolf/core/controller/dtos/MessageDto.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
package io.github.springwolf.core.controller.dtos;
33

44
import com.fasterxml.jackson.annotation.JsonCreator;
5-
import com.fasterxml.jackson.core.JsonParser;
6-
import com.fasterxml.jackson.databind.DeserializationContext;
7-
import com.fasterxml.jackson.databind.JsonDeserializer;
8-
import com.fasterxml.jackson.databind.JsonNode;
9-
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
105
import com.fasterxml.jackson.core.JsonGenerator;
116
import com.fasterxml.jackson.core.JsonParser;
127
import com.fasterxml.jackson.databind.DeserializationContext;

springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/controller/dtos/MessageDtoTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
import com.fasterxml.jackson.databind.JsonNode;
55
import com.fasterxml.jackson.databind.ObjectMapper;
66
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
7+
import com.fasterxml.jackson.databind.json.JsonMapper;
78
import com.fasterxml.jackson.databind.node.JsonNodeType;
89
import io.github.springwolf.core.controller.dtos.MessageDto;
9-
import io.swagger.v3.core.util.Json;
1010
import org.junit.jupiter.api.Test;
1111

1212
import static java.util.Collections.singletonMap;
1313
import static org.assertj.core.api.Assertions.assertThat;
1414

1515
class MessageDtoTest {
16-
private static final ObjectMapper objectMapper = Json.mapper();
16+
private static final JsonMapper jsonMapper = JsonMapper.builder().build();
1717

1818
@Test
1919
void canBeSerialized() throws Exception {
@@ -22,7 +22,7 @@ void canBeSerialized() throws Exception {
2222
+ "\"type\": \""
2323
+ MessageDto.class.getCanonicalName() + "\"" + "}";
2424

25-
MessageDto value = objectMapper.readValue(content, MessageDto.class);
25+
MessageDto value = jsonMapper.readValue(content, MessageDto.class);
2626

2727
assertThat(value).isNotNull();
2828
assertThat(value.getHeaders())
@@ -42,8 +42,8 @@ void serializationWithDifferentNamingStrategiesIsIndifferent() throws Exception
4242
.type(MessageDto.class.getCanonicalName())
4343
.build();
4444

45-
String expected = objectMapper.writeValueAsString(messageDto);
46-
String actual = objectMapper
45+
String expected = jsonMapper.writeValueAsString(messageDto);
46+
String actual = jsonMapper
4747
.copy()
4848
.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
4949
.writeValueAsString(messageDto);
@@ -57,7 +57,7 @@ void canDeserializeStringHeaderValue() throws Exception {
5757
String content = "\"12345\"";
5858

5959
// when
60-
MessageDto.HeaderValue value = objectMapper.readValue(content, MessageDto.HeaderValue.class);
60+
MessageDto.HeaderValue value = jsonMapper.readValue(content, MessageDto.HeaderValue.class);
6161

6262
// then
6363
assertThat(value).isEqualTo(new MessageDto.HeaderValue("12345"));
@@ -69,7 +69,7 @@ void canDeserializeNumericHeaderValue() throws Exception {
6969
String content = "12345";
7070

7171
// when
72-
MessageDto.HeaderValue value = objectMapper.readValue(content, MessageDto.HeaderValue.class);
72+
MessageDto.HeaderValue value = jsonMapper.readValue(content, MessageDto.HeaderValue.class);
7373

7474
// then
7575
assertThat(value).isEqualTo(new MessageDto.HeaderValue("12345"));
@@ -81,7 +81,7 @@ void canSerializeNumericHeaderValue() throws Exception {
8181
MessageDto.HeaderValue headerValue = new MessageDto.HeaderValue("12345");
8282

8383
// when
84-
JsonNode json = objectMapper.valueToTree(headerValue);
84+
JsonNode json = jsonMapper.valueToTree(headerValue);
8585

8686
// then
8787
assertThat(json.getNodeType()).isEqualTo(JsonNodeType.NUMBER);

0 commit comments

Comments
 (0)