반응형

전날에 작성해 놓은 테스트를 추가하기 위해, 아침부터 테스트 코드를 작성하던 중

@MockBean이 적용되지 않는 문제가 발생했다.

 

아예 사용할 수 없도록 되어버린 것 같고, 대체가 어떻게 되었을까 찾아보다가 아래와 같은 글을 발견했다.

 

https://stackoverflow.com/questions/79243535/what-is-the-replacement-for-the-deprecated-mockbeans-in-springboot-3-4-0

 

What is the replacement for the deprecated @MockBeans in SpringBoot 3.4.0?

We defined an annotation for our tests to avoid to declare Mockito Mocks for all the test classes. @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @MockBeans(...

stackoverflow.com

 

@MockitoBean

이것으로 대체가 되었다고 한다.

 

 

이렇게 하니 적용이 되는 것을 볼 수 있다.

 

다른 프로젝트에서는 되던 것이, 버전이 바뀌었다고 되지 않아서 깜짝 놀랐었다...

+ Recent posts