Skip to content

Commit 6587a88

Browse files
committed
fix: Java 1.8 compatibility - replace var with explicit types in test files
Replace Java 10+ 'var' keyword with explicit OpenCliTypedResult<JsonNode> types in ChatgptOpenCliClientFullTest, ClaudeOpenCliClientFullTest, and DeepseekOpenCliClientFullTest.
1 parent 0e25938 commit 6587a88

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

‎src/test/java/io/github/easy4j/opencli/adapter/browser/chatgpt/ChatgptOpenCliClientFullTest.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import static org.junit.jupiter.api.Assertions.*;
44
import io.github.easy4j.opencli.adapter.browser.chatgpt.ChatgptOpenCliClient.*;
55
import io.github.easy4j.opencli.core.OpenCliResult;
6+
import io.github.easy4j.opencli.core.OpenCliTypedResult;
7+
import com.fasterxml.jackson.databind.JsonNode;
68
import io.github.easy4j.opencli.support.RecordingOpenCliExecutor;
79
import java.util.*;
810
import org.junit.jupiter.api.Test;
@@ -129,21 +131,21 @@ void shouldCallImageWithoutOptions() {
129131

130132
@Test
131133
void shouldCallAskTyped() {
132-
var r = client.askTyped("hello", null, null);
134+
OpenCliTypedResult<JsonNode> r = client.askTyped("hello", null, null);
133135
assertNotNull(r);
134136
assertNotNull(r.getStructured());
135137
}
136138

137139
@Test
138140
void shouldCallHistoryTyped() {
139-
var r = client.historyTyped(null, null);
141+
OpenCliTypedResult<JsonNode> r = client.historyTyped(null, null);
140142
assertNotNull(r);
141143
}
142144

143145
@Test
144146
void shouldCallAskTypedWithExistingJsonOption() {
145147
ChatgptCommonOptions opts = ChatgptCommonOptions.builder().jsonOutput(true).build();
146-
var r = client.askTyped("hello", opts, null);
148+
OpenCliTypedResult<JsonNode> r = client.askTyped("hello", opts, null);
147149
assertNotNull(r);
148150
}
149151
}

‎src/test/java/io/github/easy4j/opencli/adapter/browser/claude/ClaudeOpenCliClientFullTest.java‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import static org.junit.jupiter.api.Assertions.*;
44
import io.github.easy4j.opencli.adapter.browser.claude.ClaudeOpenCliClient.*;
55
import io.github.easy4j.opencli.core.OpenCliResult;
6+
import io.github.easy4j.opencli.core.OpenCliTypedResult;
7+
import com.fasterxml.jackson.databind.JsonNode;
68
import io.github.easy4j.opencli.support.RecordingOpenCliExecutor;
79
import java.util.*;
810
import org.junit.jupiter.api.Test;
@@ -83,27 +85,27 @@ void shouldCallDetail() {
8385

8486
@Test
8587
void shouldCallAskTyped() {
86-
var r = client.askTyped("hello", null, null);
88+
OpenCliTypedResult<JsonNode> r = client.askTyped("hello", null, null);
8789
assertNotNull(r);
8890
}
8991

9092
@Test
9193
void shouldCallAskTypedWithExistingJson() {
9294
ClaudeAskOptions opts = ClaudeAskOptions.builder().jsonOutput(true).build();
93-
var r = client.askTyped("hello", opts, null);
95+
OpenCliTypedResult<JsonNode> r = client.askTyped("hello", opts, null);
9496
assertNotNull(r);
9597
}
9698

9799
@Test
98100
void shouldCallAskTypedWithToBuilderJson() {
99101
ClaudeAskOptions opts = ClaudeAskOptions.builder().timeoutSeconds(30).build();
100-
var r = client.askTyped("hello", opts, null);
102+
OpenCliTypedResult<JsonNode> r = client.askTyped("hello", opts, null);
101103
assertNotNull(r);
102104
}
103105

104106
@Test
105107
void shouldCallHistoryTyped() {
106-
var r = client.historyTyped(10, null);
108+
OpenCliTypedResult<JsonNode> r = client.historyTyped(10, null);
107109
assertNotNull(r);
108110
}
109111
}

‎src/test/java/io/github/easy4j/opencli/adapter/browser/deepseek/DeepseekOpenCliClientFullTest.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import static org.junit.jupiter.api.Assertions.*;
44
import io.github.easy4j.opencli.adapter.browser.deepseek.DeepseekOpenCliClient.*;
55
import io.github.easy4j.opencli.core.OpenCliResult;
6+
import io.github.easy4j.opencli.core.OpenCliTypedResult;
7+
import com.fasterxml.jackson.databind.JsonNode;
68
import io.github.easy4j.opencli.support.RecordingOpenCliExecutor;
79
import java.util.*;
810
import org.junit.jupiter.api.Test;
@@ -70,21 +72,21 @@ void shouldCallDetail() {
7072

7173
@Test
7274
void shouldCallAskTyped() {
73-
var r = client.askTyped("hello", null, null);
75+
OpenCliTypedResult<JsonNode> r = client.askTyped("hello", null, null);
7476
assertNotNull(r);
7577
}
7678

7779
@Test
7880
void shouldCallAskTypedWithExistingJson() {
7981
DeepseekAskOptions opts = DeepseekAskOptions.builder().jsonOutput(true).build();
80-
var r = client.askTyped("hello", opts, null);
82+
OpenCliTypedResult<JsonNode> r = client.askTyped("hello", opts, null);
8183
assertNotNull(r);
8284
}
8385

8486
@Test
8587
void shouldCallAskTypedWithToBuilder() {
8688
DeepseekAskOptions opts = DeepseekAskOptions.builder().timeoutSeconds(30).build();
87-
var r = client.askTyped("hello", opts, null);
89+
OpenCliTypedResult<JsonNode> r = client.askTyped("hello", opts, null);
8890
assertNotNull(r);
8991
}
9092
}

0 commit comments

Comments
 (0)