[Spring /JUnit] Mock ๊ฐ์ฒด์™€ ์ฃผ์†Œ๊ฐ’ ๋น„๊ต ๋ฌธ์ œ - Argument(s) are different! : org.mockito.exceptions.verification.opentest4j.ArgumentsAreDifferent
ยท
Backend/Spring Boot
โ—๏ธ์—๋Ÿฌ ๋ฉ”์‹œ์ง€org.mockito.exceptions.verification.opentest4j.ArgumentsAreDifferent      ๐Ÿ’ป ๊ฐœ๋ฐœ ํ™˜๊ฒฝFramework : `Spring Boot 3.2.3`DB : `MySQL`(๋กœ์ปฌ), `H2`(ํ…Œ์ŠคํŠธ)Library : `JPA`, `QueryDSL 5.0.0`Test : `JUnit`     ๐Ÿ”Ž ์›์ธSpring์—์„œ Junit์œผ๋กœ Controller ๋‹จ์˜ ๊ฒŒ์‹œ๊ธ€ ์ˆ˜์ • ๊ธฐ๋Šฅ์„ ํ…Œ์ŠคํŠธํ•˜๋Š”๋ฐ, `verify()` ๋ถ€๋ถ„์—์„œ ๊ฒ€์ฆ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค.  @Nested @DisplayName("๊ตฌ์ธ ๊ฒŒ์‹œ๊ธ€ ์ˆ˜์ •") public class updateHiringPostTest { private Long postId; pr..
[Spring/JUnit] Mock ๊ฐ์ฒด ์„ค์ • ๋ฌธ์ œ : java.lang.AssertionError: Expecting actual not to be null
ยท
Backend/Spring Boot
โ—๏ธ์—๋Ÿฌ ๋ฉ”์‹œ์ง€java.lang.AssertionError: Expecting actual not to be null     ๐Ÿ’ป ๊ฐœ๋ฐœ ํ™˜๊ฒฝFramework : Spring Boot `3.2.3`DB : MySQL(๋กœ์ปฌ), H2(ํ…Œ์ŠคํŠธ)Library : JPA, QueryDSL `5.0.0`Test : JUnit     ๐Ÿ”Ž ์›์ธSpring์—์„œ Junit์œผ๋กœ Service ๋‹จ์˜ ๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก ๊ธฐ๋Šฅ์„ ํ…Œ์ŠคํŠธํ•˜๋Š”๋ฐ ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค.๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก ๋ฉ”์†Œ๋“œ๋Š” `save()`๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ณ , ์ƒˆ๋กœ ๋“ฑ๋ก๋œ ๊ฒŒ์‹œ๊ธ€์˜ `id`๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ์ด๋ฅผ ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์œ„ํ•ด Mock ๊ฐ์ฒด๋ฅผ ๋งŒ๋“ค์–ด `save()`๋ฅผ ์ˆ˜ํ–‰ํ•˜๋ฉด ๋ฐ˜ํ™˜ํ•˜๋„๋ก ํ–ˆ๊ณ , `getId()`๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด `id`๋กœ 1L์„ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ์„ค์ •ํ–ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก ๋ฉ”์†Œ๋“œ๋ฅผ ์‹คํ–‰ํ–ˆ์„..
[Spring/JUnit] DataJpaTest์—์„œ JPAQueryFactory Bean ๋“ฑ๋ก ์—๋Ÿฌ : No qualifying bean of type 'com.querydsl.jpa.impl.JPAQueryFactory' available
ยท
Backend/Spring Boot
Spring์—์„œ JPA์™€ QueryDSL์„ ์‚ฌ์šฉํ•˜์—ฌ DB์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒํ•˜๊ณ  ์žˆ์—ˆ๋‹ค.๊ทธ๋ฆฌ๊ณ  Repository ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋Š”๋ฐ ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค.     ๐Ÿ’ป ๊ฐœ๋ฐœ ํ™˜๊ฒฝFramework : Spring Boot `3.2.3`DB : MySQL, H2Library : JPA, QueryDSL `5.0.0`Test : JUnit     โ—๏ธ์—๋Ÿฌ ๋ฉ”์‹œ์ง€Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'XXXCustomRepositoryImpl' defined in file [.../repository/XXXCustomRepositoryImpl.class]: Unsati..
giraffe_
'Spring' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก