Skip to content

Commit f8f24f7

Browse files
committed
c
1 parent 05381c4 commit f8f24f7

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererServiceTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class CodeWhispererServiceTest : CodeWhispererTestBase() {
5656
projectRule.project.replaceService(FileContextProvider::class.java, fileContextProviderSpy, disposableRule.disposable)
5757

5858
codewhispererService.stub {
59-
onGeneric {
59+
onBlocking {
6060
getRequestContext(any(), any(), any(), any(), any())
6161
}.thenCallRealMethod()
6262
}
@@ -81,7 +81,7 @@ class CodeWhispererServiceTest : CodeWhispererTestBase() {
8181
}
8282

8383
@Test
84-
fun `getRequestContext should have customizationArn if it's present`() {
84+
fun `getRequestContext should have customizationArn if it's present`() = runTest {
8585
whenever(customizationConfig.activeCustomization(projectRule.project)).thenReturn(
8686
CodeWhispererCustomization(
8787
"fake-arn",
@@ -96,7 +96,7 @@ class CodeWhispererServiceTest : CodeWhispererTestBase() {
9696

9797
projectRule.project.replaceService(FileContextProvider::class.java, mockFileContextProvider, disposableRule.disposable)
9898
codewhispererService.stub {
99-
onGeneric {
99+
onBlocking {
100100
getRequestContext(any(), any(), any(), any(), any())
101101
}.thenCallRealMethod()
102102
}

plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererTestBase.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import org.mockito.kotlin.any
3131
import org.mockito.kotlin.argumentCaptor
3232
import org.mockito.kotlin.doAnswer
3333
import org.mockito.kotlin.doNothing
34+
import org.mockito.kotlin.doSuspendableAnswer
3435
import org.mockito.kotlin.spy
3536
import org.mockito.kotlin.stub
3637
import org.mockito.kotlin.timeout
@@ -147,7 +148,7 @@ open class CodeWhispererTestBase {
147148
mockLspInlineCompletionResponse(pythonResponse)
148149

149150
mockClientManagerRule.create<SsoOidcClient>()
150-
every { mockLanguageServer.logInlineCompletionSessionResults(any()) } returns CompletableFuture.completedFuture(Unit)
151+
every { mockLanguageServer.logInlineCompletionSessionResults(any()) } returns Unit
151152

152153
popupManagerSpy = spy(CodeWhispererPopupManager.getInstance())
153154
popupManagerSpy.reset()
@@ -165,7 +166,7 @@ open class CodeWhispererTestBase {
165166
recommendationManager = CodeWhispererRecommendationManager.getInstance()
166167
codewhispererService = spy(CodeWhispererService.getInstance())
167168
codewhispererService.stub {
168-
onGeneric {
169+
onBlocking {
169170
getWorkspaceIds(any())
170171
} doAnswer {
171172
CompletableFuture.completedFuture(LspServerConfigurations(listOf(WorkspaceInfo("file:///", "workspaceId"))))
@@ -307,15 +308,15 @@ open class CodeWhispererTestBase {
307308
val psiFileCaptor = argumentCaptor<PsiFile>()
308309
val latencyContextCaptor = argumentCaptor<LatencyContext>()
309310
codewhispererService.stub {
310-
onGeneric {
311+
onBlocking {
311312
getRequestContext(
312313
triggerTypeCaptor.capture(),
313314
editorCaptor.capture(),
314315
projectCaptor.capture(),
315316
psiFileCaptor.capture(),
316317
latencyContextCaptor.capture()
317318
)
318-
}.doAnswer {
319+
}.doSuspendableAnswer {
319320
val requestContext = codewhispererService.getRequestContext(
320321
triggerTypeCaptor.firstValue,
321322
editorCaptor.firstValue,

0 commit comments

Comments
 (0)