Skip to content

Commit 43221d3

Browse files
Copilotbrunoborges
andcommitted
Fix Spotless formatting violations in ToolInvocationTest.java
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
1 parent 34e5ea1 commit 43221d3

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

src/test/java/com/github/copilot/sdk/ToolInvocationTest.java

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
/**
1616
* Unit tests for {@link ToolInvocation}.
1717
* <p>
18-
* Tests getter methods, type-safe deserialization, and null handling
19-
* to improve coverage beyond what E2E tests exercise.
18+
* Tests getter methods, type-safe deserialization, and null handling to improve
19+
* coverage beyond what E2E tests exercise.
2020
*/
2121
public class ToolInvocationTest {
2222

@@ -25,9 +25,7 @@ public class ToolInvocationTest {
2525
*/
2626
@Test
2727
void testGettersReturnSetValues() {
28-
ToolInvocation invocation = new ToolInvocation()
29-
.setSessionId("test-session-123")
30-
.setToolCallId("call_abc123")
28+
ToolInvocation invocation = new ToolInvocation().setSessionId("test-session-123").setToolCallId("call_abc123")
3129
.setToolName("test_tool");
3230

3331
assertEquals("test-session-123", invocation.getSessionId());
@@ -50,14 +48,14 @@ void testGetArgumentsWhenNull() {
5048
@Test
5149
void testGetArgumentsReturnsMap() {
5250
ToolInvocation invocation = new ToolInvocation();
53-
51+
5452
// Create a JsonNode with some arguments
5553
ObjectNode argsNode = JsonNodeFactory.instance.objectNode();
5654
argsNode.put("location", "San Francisco");
5755
argsNode.put("units", "celsius");
58-
56+
5957
invocation.setArguments(argsNode);
60-
58+
6159
var args = invocation.getArguments();
6260
assertNotNull(args);
6361
assertEquals("San Francisco", args.get("location"));
@@ -70,14 +68,14 @@ void testGetArgumentsReturnsMap() {
7068
@Test
7169
void testGetArgumentsAsWithRecord() {
7270
ToolInvocation invocation = new ToolInvocation();
73-
71+
7472
// Create a JsonNode with weather arguments
7573
ObjectNode argsNode = JsonNodeFactory.instance.objectNode();
7674
argsNode.put("city", "Paris");
7775
argsNode.put("units", "metric");
78-
76+
7977
invocation.setArguments(argsNode);
80-
78+
8179
// Deserialize to record
8280
WeatherArgs args = invocation.getArgumentsAs(WeatherArgs.class);
8381
assertNotNull(args);
@@ -91,14 +89,14 @@ void testGetArgumentsAsWithRecord() {
9189
@Test
9290
void testGetArgumentsAsWithPojo() {
9391
ToolInvocation invocation = new ToolInvocation();
94-
92+
9593
// Create a JsonNode with user data
9694
ObjectNode argsNode = JsonNodeFactory.instance.objectNode();
9795
argsNode.put("username", "alice");
9896
argsNode.put("age", 30);
99-
97+
10098
invocation.setArguments(argsNode);
101-
99+
102100
// Deserialize to POJO
103101
UserData userData = invocation.getArgumentsAs(UserData.class);
104102
assertNotNull(userData);
@@ -107,33 +105,33 @@ void testGetArgumentsAsWithPojo() {
107105
}
108106

109107
/**
110-
* Test getArgumentsAs throws IllegalArgumentException on deserialization failure.
108+
* Test getArgumentsAs throws IllegalArgumentException on deserialization
109+
* failure.
111110
*/
112111
@Test
113112
void testGetArgumentsAsThrowsOnInvalidType() {
114113
ToolInvocation invocation = new ToolInvocation();
115-
114+
116115
// Create invalid JSON for the target type (missing required field)
117116
ObjectNode argsNode = JsonNodeFactory.instance.objectNode();
118117
argsNode.put("invalid_field", "value");
119-
118+
120119
invocation.setArguments(argsNode);
121-
120+
122121
// Try to deserialize to a type that doesn't match
123-
IllegalArgumentException exception = assertThrows(
124-
IllegalArgumentException.class,
125-
() -> invocation.getArgumentsAs(StrictType.class),
126-
"Should throw IllegalArgumentException for invalid deserialization"
127-
);
128-
122+
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class,
123+
() -> invocation.getArgumentsAs(StrictType.class),
124+
"Should throw IllegalArgumentException for invalid deserialization");
125+
129126
assertTrue(exception.getMessage().contains("Failed to deserialize arguments"));
130127
assertTrue(exception.getMessage().contains("StrictType"));
131128
}
132129

133130
/**
134131
* Record for testing type-safe argument deserialization.
135132
*/
136-
record WeatherArgs(String city, String units) {}
133+
record WeatherArgs(String city, String units) {
134+
}
137135

138136
/**
139137
* POJO for testing type-safe argument deserialization.

0 commit comments

Comments
 (0)