[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/Security] Firebase๋ฅผ ํ™œ์šฉํ•œ ์ธ์ฆ ๊ตฌํ˜„
ยท
Backend/Spring Boot
ํ”„๋กœ์ ํŠธ์˜ ์ดˆ๊ธฐ ๋ฒ„์ „์—๋Š” ๋”ฐ๋กœ ๋ฐฑ์—”๋“œ ์„œ๋ฒ„๊ฐ€ ์—†์—ˆ๊ณ , React Native์—์„œ Firebase๋ฅผ ์ด์šฉํ•ด ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ์ง„ํ–‰ํ•˜๊ณ  ์žˆ์—ˆ๋‹ค. ๋‚˜๋Š” ์ดํ›„ ํ”„๋กœ์ ํŠธ์— ํ•ฉ๋ฅ˜ํ•ด Spring์œผ๋กœ ๋‹ค๋ฅธ ์„œ๋ฒ„๋ฅผ ๊ฐœ๋ฐœํ•˜๊ณ  ์žˆ๋‹ค. ๋ฐฑ์—”๋“œ์—์„œ๋„ ์‚ฌ์šฉ์ž๋ฅผ ์‹๋ณ„ํ•˜๊ธฐ ์œ„ํ•ด Firebase๋กœ ๋ฐœ๊ธ‰๋œ ํ† ํฐ์„ ์‚ฌ์šฉํ•ด ํ”„๋ก ํŠธ์—”๋“œ์™€ ์ธ์ฆ ์ฒด๊ณ„๋ฅผ ํ†ตํ•ฉํ•  ํ•„์š”๊ฐ€ ์žˆ์—ˆ๋‹ค.  ๊ตฌํ˜„์„ ์œ„ํ•ด Firebase Token์— ๋Œ€ํ•ด ์ดํ•ดํ•˜๋Š” ๊ณผ์ •์ด ํ•„์š”ํ–ˆ๊ณ , ํ† ํฐ์„ ๋‹ค๋ฃจ๊ธฐ ์œ„ํ•ด Spring Security๋„ ํ•™์Šตํ•ด์•ผ ๋๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ตœ์ข…์ ์œผ๋กœ firebase๊ฐ€ ํฌํ•จ๋œ ์„œ๋ฒ„๋ฅผ ๋ฐฐํฌํ•˜๊ธฐ๊นŒ์ง€ ๋งŽ์€ ์‚ฝ์งˆ์„ ํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค. ๊ตฌํ˜„ํ•˜๋ฉด์„œ ๊ณต๋ถ€ํ–ˆ๋˜ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•˜๊ณ , ๊ตฌํ˜„ ๊ณผ์ •์„ ๊ณต์œ ํ•˜๊ณ ์ž ํ•œ๋‹ค!     Firebase Token? ์šฐ์„  Firebase Token์— ๋Œ€ํ•ด ..
[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] H2 ์˜ˆ์•ฝ์–ด user ๋•Œ๋ฌธ์— ๋ฐœ์ƒ : Error executing DDL "drop table if exists user cascade " via JDBC [Syntax error in SQL statement "drop table if exists [*]user cascade "; expected "identifier";]
ยท
Backend/Spring Boot
โ—๏ธ์—๋Ÿฌ ๋ฉ”์‹œ์ง€Error executing DDL "drop table if exists user cascade " via JDBC [Syntax error in SQL statement "drop table if exists [*]user cascade "; expected "identifier";]     ๐Ÿ’ป ๊ฐœ๋ฐœ ํ™˜๊ฒฝFramework : Spring Boot`3.2.3`DB : MySQL(๋กœ์ปฌ), H2(ํ…Œ์ŠคํŠธ)Library : JPA, QueryDSL`5.0.0`Test : JUnit     ๐Ÿ”Ž ์›์ธSpring์—์„œ JPA Repository ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋Š”๋ฐ ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค.DB๋Š” ๋กœ์ปฌ์—์„œ ๊ฐœ๋ฐœ์„ ์œ„ํ•ด MySQL์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์ง€๋งŒ, ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด์„œ ๋‚ด์žฅํ˜• ์ธ๋ฉ”๋ชจ๋ฆฌ DB์ธ H2๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์—ˆ๋‹ค. ..
[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..
[Spring] DTO ํด๋ž˜์Šค ๋ฐ์ดํ„ฐ ๋ฐ”์ธ๋”ฉ ์—๋Ÿฌ : com.fasterxml.jackson.databind.exc.InvalidDefinitionException : No serializer found for class
ยท
Backend/Spring Boot
๐Ÿ’ป ์—๋Ÿฌ ๋ฉ”์‹œ์ง€com.fasterxml.jackson.databind.exc.InvalidDefinitionException : No serializer found for class com.xxxxxxx.xxxxx.dto.user.ProfileDto and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.xxxxxxx.xxxxx.api.response.xxxxxxxxxx["ProfileDto"])     ๐Ÿ”Ž ์›์ธ Jackson์œผ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ”์ธ๋”ฉํ•˜๋Š” ๊ณผ์ •์—์„œ ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค.  Jack..
giraffe_
'Backend/Spring Boot' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก