Skip to content

Commit 7e95c07

Browse files
committed
Merge branch '2.x' into 3.x
2 parents 28161fc + 3dccbbd commit 7e95c07

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

release-notes/VERSION-2.x

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Project: jackson-datatype-joda
1111
#146: `DateTime` can't be serialized with its own zone
1212
(`WRITE_DATES_WITH_CONTEXT_TIME_ZONE` not respected)
1313
(fixed by Joo-Hyuk K)
14+
- Add unit test to verify goodness of SPI metadata for Modules
1415
- Generate SBOMs [JSTEP-14]
1516
1617
2.19.1 (not yet released)

src/main/resources/META-INF/services/tools.jackson.databind.JacksonModule

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/test/java/module-info.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@
1717
opens tools.jackson.datatype.joda.deser;
1818
opens tools.jackson.datatype.joda.ser;
1919
opens tools.jackson.datatype.joda.testutil.failure;
20+
21+
provides tools.jackson.databind.JacksonModule with
22+
tools.jackson.datatype.joda.JodaModule;
23+
uses tools.jackson.databind.JacksonModule;
2024
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package tools.jackson.datatype.joda;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import tools.jackson.databind.JacksonModule;
6+
7+
import static org.junit.jupiter.api.Assertions.*;
8+
9+
import java.util.ServiceLoader;
10+
11+
public class ModuleSPIMetadataTest
12+
extends JodaTestBase
13+
{
14+
@Test
15+
void testModuleSPIMetadata() {
16+
ServiceLoader<JacksonModule> loader
17+
= ServiceLoader.load(JacksonModule.class);
18+
assertTrue(loader.iterator().hasNext(),
19+
"Expected at least one `Module` implementation to be found via `ServiceLoader`");
20+
final String exp = JodaModule.class.getName();
21+
int count = 0;
22+
23+
try {
24+
for (JacksonModule service : loader) {
25+
++count;
26+
if (service.getClass().getName().equals(exp)) {
27+
return;
28+
}
29+
}
30+
} catch (Throwable t) {
31+
fail("Expected to find `"+exp+"` Module (found "+count+" so far), problem: "+t);
32+
}
33+
fail("Expected to find `"+exp+"` Module (found "+count+" others)");
34+
assertEquals(1, count);
35+
}
36+
}

0 commit comments

Comments
 (0)