Skip to content

Commit 49d29ba

Browse files
committed
Migrate from ObjectMapper to JsonMapper
1 parent 32c32af commit 49d29ba

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package org.openpodcastapi.opa;
22

3-
import com.fasterxml.jackson.databind.ObjectMapper;
43
import org.springframework.boot.SpringApplication;
54
import org.springframework.boot.autoconfigure.SpringBootApplication;
6-
import org.springframework.context.annotation.Bean;
75
import org.springframework.scheduling.annotation.EnableScheduling;
86

97
@SpringBootApplication
@@ -13,9 +11,4 @@ public class OpenPodcastAPI {
1311
static void main(String[] args) {
1412
SpringApplication.run(OpenPodcastAPI.class, args);
1513
}
16-
17-
@Bean
18-
public ObjectMapper objectMapper() {
19-
return new ObjectMapper();
20-
}
2114
}

src/test/java/org/openpodcastapi/opa/subscriptions/SubscriptionEntityRestControllerTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.openpodcastapi.opa.subscriptions;
22

3-
import com.fasterxml.jackson.databind.ObjectMapper;
43
import jakarta.persistence.EntityNotFoundException;
54
import lombok.NonNull;
65
import org.junit.jupiter.api.BeforeEach;
@@ -24,6 +23,7 @@
2423
import org.springframework.test.context.ActiveProfiles;
2524
import org.springframework.test.context.bean.override.mockito.MockitoBean;
2625
import org.springframework.test.web.servlet.MockMvc;
26+
import tools.jackson.databind.json.JsonMapper;
2727

2828
import java.time.Instant;
2929
import java.util.List;
@@ -53,7 +53,7 @@ class SubscriptionEntityRestControllerTest {
5353
private MockMvc mockMvc;
5454

5555
@Autowired
56-
private ObjectMapper objectMapper;
56+
private JsonMapper jsonMapper;
5757

5858
@Autowired
5959
private TokenService tokenService;
@@ -247,7 +247,7 @@ void createUserSubscriptions_shouldReturnMixedResponse() throws Exception {
247247
mockMvc.perform(post("/api/v1/subscriptions")
248248
.header("Authorization", "Bearer " + accessToken)
249249
.contentType(MediaType.APPLICATION_JSON)
250-
.content(objectMapper.writeValueAsString(List.of(dto1, dto2))))
250+
.content(jsonMapper.writeValueAsString(List.of(dto1, dto2))))
251251
.andExpect(status().isMultiStatus())
252252
.andDo(document("subscriptions-bulk-create-mixed",
253253
preprocessRequest(prettyPrint()),
@@ -293,7 +293,7 @@ void createUserSubscription_shouldReturnSuccess() throws Exception {
293293
mockMvc.perform(post("/api/v1/subscriptions")
294294
.header("Authorization", "Bearer " + accessToken)
295295
.contentType(MediaType.APPLICATION_JSON)
296-
.content(objectMapper.writeValueAsString(List.of(dto))))
296+
.content(jsonMapper.writeValueAsString(List.of(dto))))
297297
.andExpect(status().is2xxSuccessful())
298298
.andDo(document("subscriptions-bulk-create-success",
299299
preprocessRequest(prettyPrint()),
@@ -333,7 +333,7 @@ void createUserSubscription_shouldReturnFailure() throws Exception {
333333
mockMvc.perform(post("/api/v1/subscriptions")
334334
.header("Authorization", "Bearer " + accessToken)
335335
.contentType(MediaType.APPLICATION_JSON)
336-
.content(objectMapper.writeValueAsString(List.of(dto))))
336+
.content(jsonMapper.writeValueAsString(List.of(dto))))
337337
.andExpect(status().isBadRequest())
338338
.andDo(document("subscriptions-bulk-create-failure",
339339
preprocessRequest(prettyPrint()),

0 commit comments

Comments
 (0)