You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.Throwable: Failed to find PsiClass in the source file: KtFile: LLMProviderTest.kt, code: ```java
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito
import org.mockito.junit.MockitoJUnitRunner
@RunWith(MockitoJUnitRunner::class)
class LLMProviderTest {
private lateinit var llmProvider: LLMProvider
@Test
fun `should return default timeout value when accessed`() {
// Given
llmProvider = Mockito.mock(LLMProvider::class.java)
// When
val timeout = llmProvider.defaultTimeout
// Then
org.junit.Assert.assertEquals(600, timeout)
}
@Test
fun `should return prompt text from prompt function`() {
// Given
val promptText = "Hello, how can I help you?"
llmProvider = Mockito.mock(LLMProvider::class.java)
Mockito.`when`<llmProvider.prompt(promptText)).thenReturn("Help with something")
// When
val result = llmProvider.prompt(promptText)
// Then
org.junit.Assert.assertEquals("Help with something", result)
}
@Test
fun `should emit prompt text when streaming with system prompt and keep history is true`() {
// Given
val promptText = "What do you need?"
val systemPrompt = "System: Are you sure?"
llmProvider = Mockito.mock(LLMProvider::class.java)
Mockito.`when`<llmProvider.prompt(Mockito.anyString())).thenReturn("I need assistance")
// When
val testSubscriber = llmProvider.stream(promptText, systemPrompt, true).test()
val emittedValue = testSubscriber.values().first()
// Then
org.junit.Assert.assertEquals("I need assistance", emittedValue)
}
@Test
fun `should not emit any value when streaming with system prompt and keep history is false`() {
// Given
val promptText = "What's up?"
llmProvider = Mockito.mock(LLMProvider::class.java)
// When
val testSubscriber = llmProvider.stream(promptText, "System: Is this urgent?", false).test()
// Then
testSubscriber.assertNoValues()
}
}
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at cc.unitmesh.kotlin.provider.KotlinCodeModifier$insertMethod$1$rootElement$1.invoke(KotlinCodeModifier.kt:53)
at cc.unitmesh.kotlin.provider.KotlinCodeModifier$insertMethod$1$rootElement$1.invoke(KotlinCodeModifier.kt:49)
at com.intellij.openapi.application.ActionsKt.runReadAction$lambda$3(actions.kt:31)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:894)
at com.intellij.openapi.application.ActionsKt.runReadAction(actions.kt:31)
at cc.unitmesh.kotlin.provider.KotlinCodeModifier.insertMethod$lambda$2(KotlinCodeModifier.kt:49)
at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:843)
at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:463)
at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:75)
at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:67)
at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1436)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:82)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:124)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:44)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:695)
at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:589)
at com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:44)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:72)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:355)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:354)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:793)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:354)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:349)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:349)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:848)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:391)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
The text was updated successfully, but these errors were encountered:
Describe the bug
To Reproduce
Steps to reproduce the behavior:
Additional context
The text was updated successfully, but these errors were encountered: