-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLlmAvailabilityConditionTest.java
More file actions
56 lines (45 loc) · 1.9 KB
/
Copy pathLlmAvailabilityConditionTest.java
File metadata and controls
56 lines (45 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.dbaagent.support;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Unit tests for {@link LlmAvailabilityCondition}.
*
* <p>These tests verify the static check methods work correctly.
* The actual annotation behavior is tested by the skipped tests
* in classes like {@code ChatPromptIntegrationTest}.
*/
class LlmAvailabilityConditionTest {
@Test
void describeConfigurationReturnsReadableOutput() {
String description = LlmAvailabilityCondition.describeConfiguration();
assertThat(description)
.contains("LLM Configuration Status")
.contains("Chat:")
.contains("Embedding:");
}
@Test
void isChatConfiguredReturnsFalseWhenEnvNotSet() {
// This test verifies the check method works when env vars are not set.
// If DEEPSQL_CHAT_PROVIDER and DEEPSQL_CHAT_API_KEY are set in the
// test environment, this would return true - that's correct behavior.
boolean configured = LlmAvailabilityCondition.isChatConfigured();
// We can't assert false here because the test might run in an env with LLM configured.
// Instead, verify the method returns a boolean without throwing.
assertThat(configured).isIn(true, false);
}
@Test
void isEmbeddingConfiguredReturnsFalseWhenEnvNotSet() {
boolean configured = LlmAvailabilityCondition.isEmbeddingConfigured();
assertThat(configured).isIn(true, false);
}
@Test
void describeConfigurationShowsNotConfiguredWhenMissing() {
// Without mocking System.getenv, we verify the output format is correct
String description = LlmAvailabilityCondition.describeConfiguration();
// Should contain configuration hints
assertThat(description).containsAnyOf(
"CONFIGURED",
"NOT CONFIGURED"
);
}
}