@@ -17,6 +17,9 @@ import com.duckbox.dto.user.RegisterDto
1717import com.duckbox.errors.exception.ConflictException
1818import com.duckbox.errors.exception.ForbiddenException
1919import com.duckbox.errors.exception.NotFoundException
20+ import com.duckbox.service.ethereum.DIdService
21+ import io.mockk.mockk
22+ import io.mockk.mockkConstructor
2023import org.junit.jupiter.api.Test
2124import org.junit.jupiter.api.extension.ExtendWith
2225import org.springframework.beans.factory.annotation.Autowired
@@ -61,6 +64,7 @@ class GroupServiceTest {
6164 @Autowired
6265 private lateinit var surveyService: SurveyService
6366
67+ private lateinit var mockDidService: DIdService
6468
6569 private val mockGroupRegisterDto: GroupRegisterDto = MockDto .mockGroupRegisterDto
6670 private val mockUserEmail = " email@konkuk.ac.kr"
@@ -76,6 +80,17 @@ class GroupServiceTest {
7680 userBoxRepository.deleteAll()
7781 voteRepository.deleteAll()
7882 surveyRepository.deleteAll()
83+ mockkConstructor(DIdService ::class )
84+ mockDidService = mockk(relaxed = true )
85+ setDidService(mockDidService)
86+ }
87+
88+ // Set DidService
89+ private fun setDidService (didService : DIdService ) {
90+ UserService ::class .java.getDeclaredField(" didService" ).apply {
91+ isAccessible = true
92+ set(userService, didService)
93+ }
7994 }
8095
8196 fun registerMockUser () {
@@ -90,6 +105,7 @@ class GroupServiceTest {
90105 college = " ku" ,
91106 department = listOf (" computer" , " software" ),
92107 fcmToken = " temp" ,
108+ address = " 0x11" ,
93109 )
94110 )
95111 }
@@ -106,6 +122,7 @@ class GroupServiceTest {
106122 college = " ku" ,
107123 department = listOf (" computer" , " software" ),
108124 fcmToken = " temp" ,
125+ address = " 0x11" ,
109126 )
110127 )
111128 }
@@ -328,6 +345,7 @@ class GroupServiceTest {
328345 college = " ku" ,
329346 department = listOf (" computer" , " software" ),
330347 fcmToken = " temp" ,
348+ address = " 0x11" ,
331349 )
332350 )
333351
0 commit comments