-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/board driving : 불필요한 코드 삭제 및 mapper config 외부 연결. #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sweetykr7
wants to merge
3
commits into
main
Choose a base branch
from
feature/board-driving
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/test/kotlin/me/nettee/core/config/JacksonTestConfig.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package me.nettee.core.config | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude | ||
| import com.fasterxml.jackson.databind.ObjectMapper | ||
| import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule | ||
| import org.springframework.boot.test.context.TestConfiguration | ||
| import org.springframework.context.annotation.Bean | ||
| import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter | ||
|
|
||
| @TestConfiguration | ||
| class JacksonTestConfig { | ||
| @Bean | ||
| fun objectMapper(): ObjectMapper { | ||
| return ObjectMapper() | ||
| .registerModule(JavaTimeModule()) | ||
| .setSerializationInclusion(JsonInclude.Include.NON_NULL) | ||
| } | ||
|
|
||
| @Bean | ||
| fun mappingJackson2HttpMessageConverter(objectMapper: ObjectMapper): MappingJackson2HttpMessageConverter { | ||
| return MappingJackson2HttpMessageConverter(objectMapper) | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 이 설정 파일이 명시적으로 필요한 이유가 무엇인가요?
이 설정 파일이 어떨 때 필요하고, 있을 때와 없을 때 어떤 차이가 있는지 궁금합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merge-simpson 바쁜 와중에도 질문 남겨주셔서 감사합니다.
메인 프로젝트의 Jackson 설정이 테스트 환경에 적용되지 않는 문제를 해결하기 위해,
테스트 환경에서도 동일한 설정이 유지되도록 ObjectMapper와 MappingJackson2HttpMessageConverter를 수동으로 @bean 등록하였습니다.
이 설정 파일은 컨트롤러 테스트에서 활용하는 것이 적절해 보이며, 이를 적용하면 HTTP 통신 테스트에서 null 값이 JSON 직렬화되지 않는 차이가 있습니다.