@@ -26,6 +26,7 @@ import io.mockk.runs
2626import io.mockk.slot
2727import io.mockk.verify
2828import kotlinx.coroutines.test.runTest
29+ import org.assertj.core.api.Assertions.assertThat
2930import org.eclipse.lsp4j.CreateFilesParams
3031import org.eclipse.lsp4j.DeleteFilesParams
3132import org.eclipse.lsp4j.DidChangeWatchedFilesParams
@@ -35,7 +36,6 @@ import org.eclipse.lsp4j.RenameFilesParams
3536import org.eclipse.lsp4j.WorkspaceFolder
3637import org.eclipse.lsp4j.jsonrpc.messages.ResponseMessage
3738import org.eclipse.lsp4j.services.WorkspaceService
38- import org.junit.jupiter.api.Assertions.assertEquals
3939import org.junit.jupiter.api.BeforeEach
4040import org.junit.jupiter.api.Test
4141import software.aws.toolkits.jetbrains.services.amazonq.lsp.AmazonQLanguageServer
@@ -108,7 +108,7 @@ class WorkspaceServiceHandlerTest {
108108
109109 val paramsSlot = slot<CreateFilesParams >()
110110 verify { mockWorkspaceService.didCreateFiles(capture(paramsSlot)) }
111- assertEquals(normalizeFileUri(pyUri.toString()), paramsSlot.captured.files[0 ].uri)
111+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(pyUri.toString()) )
112112 }
113113
114114 @Test
@@ -120,7 +120,7 @@ class WorkspaceServiceHandlerTest {
120120
121121 val paramsSlot = slot<CreateFilesParams >()
122122 verify { mockWorkspaceService.didCreateFiles(capture(paramsSlot)) }
123- assertEquals(normalizeFileUri(tsUri.toString()), paramsSlot.captured.files[0 ].uri)
123+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(tsUri.toString()) )
124124 }
125125
126126 @Test
@@ -132,7 +132,7 @@ class WorkspaceServiceHandlerTest {
132132
133133 val paramsSlot = slot<CreateFilesParams >()
134134 verify { mockWorkspaceService.didCreateFiles(capture(paramsSlot)) }
135- assertEquals(normalizeFileUri(jsUri.toString()), paramsSlot.captured.files[0 ].uri)
135+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(jsUri.toString()) )
136136 }
137137
138138 @Test
@@ -144,7 +144,7 @@ class WorkspaceServiceHandlerTest {
144144
145145 val paramsSlot = slot<CreateFilesParams >()
146146 verify { mockWorkspaceService.didCreateFiles(capture(paramsSlot)) }
147- assertEquals(normalizeFileUri(javaUri.toString()), paramsSlot.captured.files[0 ].uri)
147+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(javaUri.toString()) )
148148 }
149149
150150 @Test
@@ -156,7 +156,7 @@ class WorkspaceServiceHandlerTest {
156156
157157 val paramsSlot = slot<CreateFilesParams >()
158158 verify { mockWorkspaceService.didCreateFiles(capture(paramsSlot)) }
159- assertEquals(normalizeFileUri(dirUri.toString()), paramsSlot.captured.files[0 ].uri)
159+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(dirUri.toString()) )
160160 }
161161
162162 @Test
@@ -179,7 +179,7 @@ class WorkspaceServiceHandlerTest {
179179
180180 val paramsSlot = slot<CreateFilesParams >()
181181 verify { mockWorkspaceService.didCreateFiles(capture(paramsSlot)) }
182- assertEquals(normalizeFileUri(newUri.toString()), paramsSlot.captured.files[0 ].uri)
182+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(newUri.toString()) )
183183 }
184184
185185 @Test
@@ -192,7 +192,7 @@ class WorkspaceServiceHandlerTest {
192192
193193 val paramsSlot = slot<CreateFilesParams >()
194194 verify { mockWorkspaceService.didCreateFiles(capture(paramsSlot)) }
195- assertEquals(normalizeFileUri(newUri.toString()), paramsSlot.captured.files[0 ].uri)
195+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(newUri.toString()) )
196196 }
197197
198198 @Test
@@ -204,7 +204,7 @@ class WorkspaceServiceHandlerTest {
204204
205205 val paramsSlot = slot<DeleteFilesParams >()
206206 verify { mockWorkspaceService.didDeleteFiles(capture(paramsSlot)) }
207- assertEquals(normalizeFileUri(pyUri.toString()), paramsSlot.captured.files[0 ].uri)
207+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(pyUri.toString()) )
208208 }
209209
210210 @Test
@@ -216,7 +216,7 @@ class WorkspaceServiceHandlerTest {
216216
217217 val paramsSlot = slot<DeleteFilesParams >()
218218 verify { mockWorkspaceService.didDeleteFiles(capture(paramsSlot)) }
219- assertEquals(normalizeFileUri(tsUri.toString()), paramsSlot.captured.files[0 ].uri)
219+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(tsUri.toString()) )
220220 }
221221
222222 @Test
@@ -228,7 +228,7 @@ class WorkspaceServiceHandlerTest {
228228
229229 val paramsSlot = slot<DeleteFilesParams >()
230230 verify { mockWorkspaceService.didDeleteFiles(capture(paramsSlot)) }
231- assertEquals(normalizeFileUri(jsUri.toString()), paramsSlot.captured.files[0 ].uri)
231+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(jsUri.toString()) )
232232 }
233233
234234 @Test
@@ -240,7 +240,7 @@ class WorkspaceServiceHandlerTest {
240240
241241 val paramsSlot = slot<DeleteFilesParams >()
242242 verify { mockWorkspaceService.didDeleteFiles(capture(paramsSlot)) }
243- assertEquals(normalizeFileUri(javaUri.toString()), paramsSlot.captured.files[0 ].uri)
243+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(javaUri.toString()) )
244244 }
245245
246246 @Test
@@ -262,7 +262,7 @@ class WorkspaceServiceHandlerTest {
262262
263263 val paramsSlot = slot<DeleteFilesParams >()
264264 verify { mockWorkspaceService.didDeleteFiles(capture(paramsSlot)) }
265- assertEquals(normalizeFileUri(dirUri.toString()), paramsSlot.captured.files[0 ].uri)
265+ assertThat( paramsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(dirUri.toString()) )
266266 }
267267
268268 @Test
@@ -278,9 +278,9 @@ class WorkspaceServiceHandlerTest {
278278
279279 val deleteParamsSlot = slot<DeleteFilesParams >()
280280 verify { mockWorkspaceService.didDeleteFiles(capture(deleteParamsSlot)) }
281- assertEquals( 2 , deleteParamsSlot.captured.files.size )
282- assertEquals(normalizeFileUri(deleteUri.toString()), deleteParamsSlot.captured.files[0 ].uri)
283- assertEquals(normalizeFileUri(oldMoveUri.toString()), deleteParamsSlot.captured.files[1 ].uri)
281+ assertThat( deleteParamsSlot.captured.files).hasSize( 2 )
282+ assertThat( deleteParamsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(deleteUri.toString()) )
283+ assertThat( deleteParamsSlot.captured.files[1 ].uri).isEqualTo(normalizeFileUri(oldMoveUri.toString()) )
284284 }
285285
286286 @Test
@@ -304,7 +304,7 @@ class WorkspaceServiceHandlerTest {
304304
305305 val deleteParamsSlot = slot<DeleteFilesParams >()
306306 verify { mockWorkspaceService.didDeleteFiles(capture(deleteParamsSlot)) }
307- assertEquals(normalizeFileUri(oldUri.toString()), deleteParamsSlot.captured.files[0 ].uri)
307+ assertThat( deleteParamsSlot.captured.files[0 ].uri).isEqualTo(normalizeFileUri(oldUri.toString()) )
308308 }
309309
310310 @Test
@@ -324,12 +324,12 @@ class WorkspaceServiceHandlerTest {
324324 // Assert
325325 val paramsSlot = slot<DidChangeWatchedFilesParams >()
326326 verify { mockWorkspaceService.didChangeWatchedFiles(capture(paramsSlot)) }
327- assertEquals(normalizeFileUri(createURI.toString()), paramsSlot.captured.changes[0 ].uri)
328- assertEquals( FileChangeType . Created , paramsSlot.captured.changes[0 ].type)
329- assertEquals(normalizeFileUri(deleteURI.toString()), paramsSlot.captured.changes[1 ].uri)
330- assertEquals( FileChangeType . Deleted , paramsSlot.captured.changes[1 ].type)
331- assertEquals(normalizeFileUri(changeURI.toString()), paramsSlot.captured.changes[2 ].uri)
332- assertEquals( FileChangeType . Changed , paramsSlot.captured.changes[2 ].type)
327+ assertThat( paramsSlot.captured.changes[0 ].uri).isEqualTo(normalizeFileUri(createURI.toString()) )
328+ assertThat( paramsSlot.captured.changes[0 ].type).isEqualTo( FileChangeType . Created )
329+ assertThat( paramsSlot.captured.changes[1 ].uri).isEqualTo(normalizeFileUri(deleteURI.toString()) )
330+ assertThat( paramsSlot.captured.changes[1 ].type).isEqualTo( FileChangeType . Deleted )
331+ assertThat( paramsSlot.captured.changes[2 ].uri).isEqualTo(normalizeFileUri(changeURI.toString()) )
332+ assertThat( paramsSlot.captured.changes[2 ].type).isEqualTo( FileChangeType . Changed )
333333 }
334334
335335 @Test
@@ -343,11 +343,11 @@ class WorkspaceServiceHandlerTest {
343343 val paramsSlot = slot<DidChangeWatchedFilesParams >()
344344 verify { mockWorkspaceService.didChangeWatchedFiles(capture(paramsSlot)) }
345345
346- assertEquals( 2 , paramsSlot.captured.changes.size )
347- assertEquals(normalizeFileUri(oldUri.toString()), paramsSlot.captured.changes[0 ].uri)
348- assertEquals( FileChangeType . Deleted , paramsSlot.captured.changes[0 ].type)
349- assertEquals(normalizeFileUri(newUri.toString()), paramsSlot.captured.changes[1 ].uri)
350- assertEquals( FileChangeType . Created , paramsSlot.captured.changes[1 ].type)
346+ assertThat( paramsSlot.captured.changes).hasSize( 2 )
347+ assertThat( paramsSlot.captured.changes[0 ].uri).isEqualTo(normalizeFileUri(oldUri.toString()) )
348+ assertThat( paramsSlot.captured.changes[0 ].type).isEqualTo( FileChangeType . Deleted )
349+ assertThat( paramsSlot.captured.changes[1 ].uri).isEqualTo(normalizeFileUri(newUri.toString()) )
350+ assertThat( paramsSlot.captured.changes[1 ].type).isEqualTo( FileChangeType . Created )
351351 }
352352
353353 @Test
@@ -360,8 +360,8 @@ class WorkspaceServiceHandlerTest {
360360
361361 val paramsSlot = slot<DidChangeWatchedFilesParams >()
362362 verify { mockWorkspaceService.didChangeWatchedFiles(capture(paramsSlot)) }
363- assertEquals(normalizeFileUri(newUri.toString()), paramsSlot.captured.changes[0 ].uri)
364- assertEquals( FileChangeType . Created , paramsSlot.captured.changes[0 ].type)
363+ assertThat( paramsSlot.captured.changes[0 ].uri).isEqualTo(normalizeFileUri(newUri.toString()) )
364+ assertThat( paramsSlot.captured.changes[0 ].type).isEqualTo( FileChangeType . Created )
365365 }
366366
367367 @Test
@@ -393,8 +393,8 @@ class WorkspaceServiceHandlerTest {
393393 val paramsSlot = slot<RenameFilesParams >()
394394 verify { mockWorkspaceService.didRenameFiles(capture(paramsSlot)) }
395395 with (paramsSlot.captured.files[0 ]) {
396- assertEquals( normalizeFileUri(" file:///testDir/$oldName " ), oldUri )
397- assertEquals( normalizeFileUri(" file:///testDir/$newName " ), newUri )
396+ assertThat(oldUri).isEqualTo( normalizeFileUri(" file:///testDir/$oldName " ))
397+ assertThat(newUri).isEqualTo( normalizeFileUri(" file:///testDir/$newName " ))
398398 }
399399 }
400400
@@ -430,8 +430,8 @@ class WorkspaceServiceHandlerTest {
430430 val paramsSlot = slot<RenameFilesParams >()
431431 verify { mockWorkspaceService.didRenameFiles(capture(paramsSlot)) }
432432 with (paramsSlot.captured.files[0 ]) {
433- assertEquals( normalizeFileUri(" file:///testDir/oldDir" ), oldUri )
434- assertEquals( normalizeFileUri(" file:///testDir/newDir" ), newUri )
433+ assertThat(oldUri).isEqualTo( normalizeFileUri(" file:///testDir/oldDir" ))
434+ assertThat(newUri).isEqualTo( normalizeFileUri(" file:///testDir/newDir" ))
435435 }
436436 }
437437
@@ -453,7 +453,7 @@ class WorkspaceServiceHandlerTest {
453453 // Assert
454454 val paramsSlot = slot<RenameFilesParams >()
455455 verify { mockWorkspaceService.didRenameFiles(capture(paramsSlot)) }
456- assertEquals( 2 , paramsSlot.captured.files.size )
456+ assertThat( paramsSlot.captured.files).hasSize( 2 )
457457 }
458458
459459 @Test
@@ -498,8 +498,8 @@ class WorkspaceServiceHandlerTest {
498498 // Assert
499499 val paramsSlot = slot<DidChangeWorkspaceFoldersParams >()
500500 verify(exactly = 1 ) { mockWorkspaceService.didChangeWorkspaceFolders(capture(paramsSlot)) }
501- assertEquals( 1 , paramsSlot.captured.event.added.size )
502- assertEquals( " folder1 " , paramsSlot.captured.event.added[0 ].name)
501+ assertThat( paramsSlot.captured.event.added).hasSize( 1 )
502+ assertThat( paramsSlot.captured.event.added[0 ].name).isEqualTo( " folder1 " )
503503 }
504504
505505 // rootsChanged handles additional files added to root
@@ -533,8 +533,8 @@ class WorkspaceServiceHandlerTest {
533533 // Assert
534534 val paramsSlot = slot<DidChangeWorkspaceFoldersParams >()
535535 verify(exactly = 1 ) { mockWorkspaceService.didChangeWorkspaceFolders(capture(paramsSlot)) }
536- assertEquals( 1 , paramsSlot.captured.event.added.size )
537- assertEquals( " folder2 " , paramsSlot.captured.event.added[0 ].name)
536+ assertThat( paramsSlot.captured.event.added).hasSize( 1 )
537+ assertThat( paramsSlot.captured.event.added[0 ].name).isEqualTo( " folder2 " )
538538 }
539539
540540 // rootsChanged handles removal of files from root
@@ -568,8 +568,8 @@ class WorkspaceServiceHandlerTest {
568568 // Assert
569569 val paramsSlot = slot<DidChangeWorkspaceFoldersParams >()
570570 verify(exactly = 1 ) { mockWorkspaceService.didChangeWorkspaceFolders(capture(paramsSlot)) }
571- assertEquals( 1 , paramsSlot.captured.event.removed.size )
572- assertEquals( " folder2 " , paramsSlot.captured.event.removed[0 ].name)
571+ assertThat( paramsSlot.captured.event.removed).hasSize( 1 )
572+ assertThat( paramsSlot.captured.event.removed[0 ].name).isEqualTo( " folder2 " )
573573 }
574574
575575 @Test
@@ -606,10 +606,10 @@ class WorkspaceServiceHandlerTest {
606606 // Assert
607607 val paramsSlot = slot<DidChangeWorkspaceFoldersParams >()
608608 verify(exactly = 1 ) { mockWorkspaceService.didChangeWorkspaceFolders(capture(paramsSlot)) }
609- assertEquals( 1 , paramsSlot.captured.event.added.size )
610- assertEquals( 1 , paramsSlot.captured.event.removed.size )
611- assertEquals( " folder3 " , paramsSlot.captured.event.added[0 ].name)
612- assertEquals( " folder2 " , paramsSlot.captured.event.removed[0 ].name)
609+ assertThat( paramsSlot.captured.event.added).hasSize( 1 )
610+ assertThat( paramsSlot.captured.event.removed).hasSize( 1 )
611+ assertThat( paramsSlot.captured.event.added[0 ].name).isEqualTo( " folder3 " )
612+ assertThat( paramsSlot.captured.event.removed[0 ].name).isEqualTo( " folder2 " )
613613 }
614614
615615 private fun createMockVirtualFile (uri : URI , fileName : String , isDirectory : Boolean = false): VirtualFile {
0 commit comments