File tree Expand file tree Collapse file tree 3 files changed +40
-5
lines changed
main/java/software/amazon/awssdk/codegen/utils
test/java/software/amazon/awssdk/codegen/utils
core/sdk-core/src/test/java/software/amazon/awssdk/core/internal/useragent Expand file tree Collapse file tree 3 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -28,11 +28,11 @@ private VersionUtils() {
28
28
29
29
/**
30
30
* Converts a full version string to a major.minor.x format.
31
- *
32
- * @param version The full version string to convert (e.g., "2.32.1")
33
- * @return The version string in major.minor.x format (e.g., "2.32.x"),
34
- * or the original string if it doesn't match the expected version pattern
35
- */
31
+ *
32
+ * @param version The full version string to convert (e.g., "2.32.1")
33
+ * @return The version string in major.minor.x format (e.g., "2.32.x"),
34
+ * or the original string if it doesn't match the expected version pattern
35
+ */
36
36
public static String convertToMajorMinorX (String version ) {
37
37
Pattern pattern = Pattern .compile ("(\\ d+)\\ .(\\ d+)\\ .(\\ d+)(.*)" );
38
38
Matcher matcher = pattern .matcher (version );
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
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
+ * A copy of the License is located at
7
+ *
8
+ * http://aws.amazon.com/apache2.0
9
+ *
10
+ * or in the "license" file accompanying this file. This file is distributed
11
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
+ * express or implied. See the License for the specific language governing
13
+ * permissions and limitations under the License.
14
+ */
15
+
16
+ package software .amazon .awssdk .codegen .utils ;
17
+
18
+ import static org .assertj .core .api .Assertions .assertThat ;
19
+
20
+ import org .junit .Test ;
21
+
22
+ public class VersionUtilsTest {
23
+
24
+ @ Test
25
+ public void serviceVersionInfo_redactPatchVersion () {
26
+ String currentVersion = "2.35.13" ;
27
+ String currentSnapshotVersion = "2.35.13-SNAPSHOT" ;
28
+
29
+ String actualVersion = VersionUtils .convertToMajorMinorX (currentVersion );
30
+ String actualSnapshotVersion = VersionUtils .convertToMajorMinorX (currentSnapshotVersion );
31
+ assertThat (actualVersion ).isEqualTo ("2.35.x" );
32
+ assertThat (actualSnapshotVersion ).isEqualTo ("2.35.x-SNAPSHOT" );
33
+ }
34
+ }
Original file line number Diff line number Diff line change 27
27
import java .util .List ;
28
28
import java .util .Optional ;
29
29
import java .util .stream .Stream ;
30
+ import org .junit .Test ;
30
31
import org .junit .jupiter .params .ParameterizedTest ;
31
32
import org .junit .jupiter .params .provider .Arguments ;
32
33
import org .junit .jupiter .params .provider .MethodSource ;
You can’t perform that action at this time.
0 commit comments