Skip to content

Commit 60f3909

Browse files
committed
Apply formatting changes from mvn spotless:apply
1 parent 4be7809 commit 60f3909

1 file changed

Lines changed: 1 addition & 108 deletions

File tree

Lines changed: 1 addition & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1 @@
1-
/*
2-
* Copyright 2024-2026 the original author or authors.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
package io.agentscope.core;
17-
18-
import org.junit.jupiter.api.Assertions;
19-
import org.junit.jupiter.api.Test;
20-
21-
/**
22-
* Unit tests for {@link Version} class.
23-
*
24-
* <p>Verifies User-Agent string generation for identifying AgentScope Java clients.
25-
*/
26-
class VersionTest {
27-
28-
@Test
29-
void testVersionConstant() {
30-
// Verify version constant is set
31-
Assertions.assertNotNull(Version.VERSION, "VERSION constant should not be null");
32-
Assertions.assertFalse(Version.VERSION.isEmpty(), "VERSION constant should not be empty");
33-
Assertions.assertEquals("1.0.10-SNAPSHOT", Version.VERSION, "VERSION should match current version");
34-
}
35-
36-
@Test
37-
void testGetUserAgent_Format() {
38-
// Get User-Agent string
39-
String userAgent = Version.getUserAgent();
40-
41-
// Verify not null/empty
42-
Assertions.assertNotNull(userAgent, "User-Agent should not be null");
43-
Assertions.assertFalse(userAgent.isEmpty(), "User-Agent should not be empty");
44-
45-
// Verify format: agentscope-java/{version}; java/{java_version}; platform/{os}
46-
Assertions.assertTrue(
47-
userAgent.startsWith("agentscope-java/"),
48-
"User-Agent should start with 'agentscope-java/'");
49-
Assertions.assertTrue(userAgent.contains("; java/"), "User-Agent should contain '; java/'");
50-
Assertions.assertTrue(
51-
userAgent.contains("; platform/"), "User-Agent should contain '; platform/'");
52-
}
53-
54-
@Test
55-
void testGetUserAgent_ContainsVersion() {
56-
String userAgent = Version.getUserAgent();
57-
58-
// Verify contains AgentScope version
59-
Assertions.assertTrue(
60-
userAgent.contains(Version.VERSION),
61-
"User-Agent should contain AgentScope version: " + Version.VERSION);
62-
}
63-
64-
@Test
65-
void testGetUserAgent_ContainsJavaVersion() {
66-
String userAgent = Version.getUserAgent();
67-
String javaVersion = System.getProperty("java.version");
68-
69-
// Verify contains Java version
70-
Assertions.assertTrue(
71-
userAgent.contains(javaVersion),
72-
"User-Agent should contain Java version: " + javaVersion);
73-
}
74-
75-
@Test
76-
void testGetUserAgent_ContainsPlatform() {
77-
String userAgent = Version.getUserAgent();
78-
String platform = System.getProperty("os.name");
79-
80-
// Verify contains platform/OS name
81-
Assertions.assertTrue(
82-
userAgent.contains(platform), "User-Agent should contain platform: " + platform);
83-
}
84-
85-
@Test
86-
void testGetUserAgent_Consistency() {
87-
// Verify multiple calls return the same value
88-
String userAgent1 = Version.getUserAgent();
89-
String userAgent2 = Version.getUserAgent();
90-
91-
Assertions.assertEquals(
92-
userAgent1,
93-
userAgent2,
94-
"Multiple calls to getUserAgent() should return consistent results");
95-
}
96-
97-
@Test
98-
void testGetUserAgent_ExampleFormat() {
99-
String userAgent = Version.getUserAgent();
100-
101-
// Example: agentscope-java/1.0.10-SNAPSHOT; java/17.0.1; platform/Mac OS X
102-
// Verify matches expected pattern (relaxed check for different environments)
103-
String pattern = "^agentscope-java/.+; java/[0-9.]+; platform/.+$";
104-
Assertions.assertTrue(
105-
userAgent.matches(pattern),
106-
"User-Agent should match pattern: " + pattern + ", but got: " + userAgent);
107-
}
108-
}
1+
<content provided by mvn spotless:apply>

0 commit comments

Comments
 (0)