Skip to content

Commit 44243bb

Browse files
committed
Migrate unit tests to Kotlin
1 parent 3614b3f commit 44243bb

File tree

15 files changed

+535
-410
lines changed

15 files changed

+535
-410
lines changed

CHANGELOG.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
* [PLANNED - 5.x - RELEASE TBD](#planned---5x---release-tbd)
1212
* [Planned changes](#planned-changes)
1313
* [CURRENT - 4.x - THIS VERSION IS UNDER ACTIVE DEVELOPMENT](#current---4x---this-version-is-under-active-development)
14-
* [4.5.0 - PLANNED](#450---planned)
14+
* [4.6.0 - PLANNED](#460---planned)
15+
* [4.5.0](#450)
1516
* [4.4.0](#440)
1617
* [4.3.0](#430)
1718
* [4.2.0](#420)
@@ -125,31 +126,46 @@ Running S3Mock in unit tests is still supported by using [TestContainers](https:
125126
* TBD
126127
* Refactorings
127128
* AWS has deprecated SDK for Java v1, and will remove support EOY 2025.
128-
* S3Mock will remove usage of Java v1 early 2026.
129+
* S3Mock will remove bundled support for Java SDK v1 in late 2025.
129130
* JUnit 4.x deprecation
130-
* JUnit 4.x will be removed from the code base.
131+
* S3Mock will remove bundled support for JUnit 4.x in late 2025.
131132
* Looking to Remove unit test modules. This enables
132133
* Refactoring S3Mock to a "standard" Spring Boot application.
133134
* Removal of workarounds to use `S3MockApplication#start` from a static context
134135
* Removal of properties workarounds
135-
* Maybe migration to `Kotlin` - the IntegrationTests were migrated already.
136+
* Migration to `Kotlin` - the IntegrationTests and unit tests were migrated already.
136137
* Version updates
137138
* Bump Spring Boot version to 4.x
138139
* Bump Spring Framework version to 7.x
139-
* Bump java version from 17 to (?)
140+
* Bump java version from 17 to 25
141+
* S3Mock will use the baseline Spring chooses to support.
142+
* The Docker container will run Java 25 LTS.
140143

141144
# CURRENT - 4.x - THIS VERSION IS UNDER ACTIVE DEVELOPMENT
142145
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.
143146

144147
**The current major version 4 will receive new features, dependency updates and bug fixes on a continuous basis.**
145148

146-
## 4.5.0 - PLANNED
149+
## 4.6.0 - PLANNED
147150
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.
148151

149152
* Features and fixes
150-
* none
153+
* TBD
151154
* Refactorings
152-
* none
155+
* TBD
156+
* Version updates (deliverable dependencies)
157+
* TBD
158+
* Version updates (build dependencies)
159+
* TBD
160+
161+
## 4.5.0
162+
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.
163+
164+
* Features and fixes
165+
* Implement DeleteObjectTagging API
166+
* Refactorings
167+
* Add JSpecify annotations to S3Mock code
168+
* Migrate unit tests in "testsupport" modules to Kotlin
153169
* Version updates (deliverable dependencies)
154170
* Bump alpine from 3.21.3 to 3.22.0 in /docker
155171
* Bump aws.version from 1.12.783 to 1.12.785

testsupport/common/pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,30 @@
8484
<artifactId>aws-xml-protocol</artifactId>
8585
<scope>test</scope>
8686
</dependency>
87+
<dependency>
88+
<groupId>org.jetbrains.kotlin</groupId>
89+
<artifactId>kotlin-stdlib-jdk8</artifactId>
90+
<scope>test</scope>
91+
</dependency>
92+
<dependency>
93+
<groupId>org.jetbrains.kotlin</groupId>
94+
<artifactId>kotlin-test-junit</artifactId>
95+
<scope>test</scope>
96+
</dependency>
97+
<dependency>
98+
<groupId>org.mockito.kotlin</groupId>
99+
<artifactId>mockito-kotlin</artifactId>
100+
<scope>test</scope>
101+
</dependency>
87102
</dependencies>
103+
104+
<build>
105+
<plugins>
106+
<plugin>
107+
<groupId>org.jetbrains.kotlin</groupId>
108+
<artifactId>kotlin-maven-plugin</artifactId>
109+
<version>${kotlin.version}</version>
110+
</plugin>
111+
</plugins>
112+
</build>
88113
</project>

testsupport/common/src/test/java/com/adobe/testing/s3mock/testsupport/common/S3MockStarterTest.java

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2017-2025 Adobe.
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+
17+
package com.adobe.testing.s3mock.testsupport.common
18+
19+
import com.adobe.testing.s3mock.S3MockApplication
20+
import org.assertj.core.api.Assertions.assertThat
21+
import org.junit.jupiter.api.Test
22+
23+
class S3MockStarterTest {
24+
25+
/**
26+
* Tests startup and shutdown of S3MockApplication.
27+
*/
28+
@Test
29+
fun testS3MockApplication() {
30+
val properties = mapOf(
31+
S3MockApplication.PROP_HTTPS_PORT to S3MockApplication.RANDOM_PORT.toString(),
32+
S3MockApplication.PROP_HTTP_PORT to S3MockApplication.RANDOM_PORT.toString(),
33+
S3MockApplication.PROP_INITIAL_BUCKETS to "bucket"
34+
)
35+
36+
val s3MockApplication = S3MockStarterTestImpl(properties)
37+
s3MockApplication.start()
38+
39+
assertThat(s3MockApplication.httpPort).isPositive()
40+
val buckets = s3MockApplication.createS3ClientV2().use { s3ClientV2 ->
41+
s3ClientV2.listBuckets().buckets()
42+
}
43+
assertThat(buckets[0].name()).isEqualTo("bucket")
44+
45+
s3MockApplication.stop()
46+
}
47+
48+
/**
49+
* Just needed to instantiate the S3MockStarter.
50+
* The instance provides an S3Client that is pre-configured to connect to the S3MockApplication.
51+
*/
52+
private class S3MockStarterTestImpl(properties: Map<String, String>) : S3MockStarter(properties)
53+
}

testsupport/junit5/pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,30 @@
5151
<artifactId>junit-jupiter-engine</artifactId>
5252
<scope>test</scope>
5353
</dependency>
54+
<dependency>
55+
<groupId>org.jetbrains.kotlin</groupId>
56+
<artifactId>kotlin-stdlib-jdk8</artifactId>
57+
<scope>test</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.jetbrains.kotlin</groupId>
61+
<artifactId>kotlin-test-junit</artifactId>
62+
<scope>test</scope>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.mockito.kotlin</groupId>
66+
<artifactId>mockito-kotlin</artifactId>
67+
<scope>test</scope>
68+
</dependency>
5469
</dependencies>
70+
71+
<build>
72+
<plugins>
73+
<plugin>
74+
<groupId>org.jetbrains.kotlin</groupId>
75+
<artifactId>kotlin-maven-plugin</artifactId>
76+
<version>${kotlin.version}</version>
77+
</plugin>
78+
</plugins>
79+
</build>
5580
</project>

testsupport/junit5/src/test/java/com/adobe/testing/s3mock/junit5/sdk2/S3MockExtensionDeclarativeTest.java

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)