Skip to content
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

JUnit 5 + Kotlin 테스트 클래스에서 생성자 주입 이슈 · 도전하는 개발자 #6

Open
utterances-bot opened this issue Sep 27, 2020 · 11 comments

Comments

@utterances-bot
Copy link

JUnit 5 + Kotlin 테스트 클래스에서 생성자 주입 이슈 · 도전하는 개발자

서론

https://minkukjo.github.io/framework/2020/06/28/JUnit-23/

Copy link

ghost commented Sep 27, 2020

감사합니다. 테스트에 관해 거의 무지했는데 해당 포스팅으로 많은 도움이 되었습니다!!!

Copy link
Owner

@jhun91 도움이 되셨다니 기쁩니다 ㅎㅎ

Copy link

joseph415 commented Feb 2, 2021

안녕하세요! 글 잘 읽었습니다! 궁금한 부분이 해결될 듯 말 듯 해서 질문드려요 ㅎ
SpringExtension.class 를 사용했을때 WebApplicationContext 같은 경우에는 parameter로 들어갔을 시
autowired 를 적어주지 않아도 주입되는걸 볼 수 있는데 이것은
parameterResolver에 의해서 autowired가 없어도 주입된다고 생각하면 될까요?

나머지 경우에는 autowired가 선언되야 autowired가 되는거고 WebApplicationContext 경우에만 특별한 객체라고 생각하면 될까요?

Copy link

문서확인해보니

  1. The declaring executable is a Constructor and TestConstructorUtils.isAutowirableConstructor(Constructor, Class, PropertyProvider) returns true. Note that isAutowirableConstructor() will be invoked with a fallback PropertyProvider that delegates its lookup to ExtensionContext.getConfigurationParameter(String).

2. The parameter is of type ApplicationContext or a sub-type thereof.

  1. ParameterResolutionDelegate.isAutowirable returns true.

라고 2번째경우에 supportsParameter에서 true리턴하도록 되어있네요!
글을 쉽게 잘 써주셔서 이해하는데 도움 많이 되었습니다!

Copy link
Owner

minkukjo commented Feb 3, 2021

@joseph415
내용 공유 감사드립니다~ 도움이 되셨다니 기쁘네요 ^^

Copy link

mintavi commented Sep 26, 2021

감사합니다 ㅠㅠㅠ 많이 헤매고 있었는데 큰 도움이 되었습니당...!!

@minkukjo
Copy link
Owner

@mintavi
도움이 되셨다니 기쁩니다! :)

Copy link

ReasonH commented Jan 3, 2022

많은 도움 되었습니다. 감사합니다 ^^

@minkukjo
Copy link
Owner

minkukjo commented Jan 3, 2022

@ReasonH
도움이 되셨다니 기쁩니다.
새해복 많이 받으세요~

Copy link

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 주피터 귀엽네요 ㅎㅎ

Copy link

좋아용

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants