Skip to content

Commit 423b61a

Browse files
committed
Merge branch '2.x' into 3.x
2 parents 47c2364 + 29e0db1 commit 423b61a

16 files changed

Lines changed: 273 additions & 3 deletions

File tree

afterburner/src/test/java/module-info.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@
4242
opens tools.jackson.module.afterburner.testutil;
4343
opens tools.jackson.module.afterburner.testutil.failure;
4444
opens tools.jackson.module.afterburner.util;
45+
46+
provides tools.jackson.databind.JacksonModule with
47+
tools.jackson.module.afterburner.AfterburnerModule;
48+
uses tools.jackson.databind.JacksonModule;
4549
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package tools.jackson.module.afterburner;
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 AfterburnerTestBase
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 = AfterburnerModule.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+
}

android-record/src/test/java/module-info.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@
1818
opens tools.jackson.module.androidrecord;
1919
opens tools.jackson.module.androidrecord.testutil.failure;
2020
opens tools.jackson.module.androidrecord.tofix;
21+
22+
provides tools.jackson.databind.JacksonModule with
23+
tools.jackson.module.androidrecord.AndroidRecordModule;
24+
uses tools.jackson.databind.JacksonModule;
2125
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package tools.jackson.module.androidrecord;
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+
{
13+
@Test
14+
void testModuleSPIMetadata() {
15+
ServiceLoader<JacksonModule> loader
16+
= ServiceLoader.load(JacksonModule.class);
17+
assertTrue(loader.iterator().hasNext(),
18+
"Expected at least one `Module` implementation to be found via `ServiceLoader`");
19+
final String exp = AndroidRecordModule.class.getName();
20+
int count = 0;
21+
22+
try {
23+
for (JacksonModule service : loader) {
24+
++count;
25+
if (service.getClass().getName().equals(exp)) {
26+
return;
27+
}
28+
}
29+
} catch (Throwable t) {
30+
fail("Expected to find `"+exp+"` Module (found "+count+" so far), problem: "+t);
31+
}
32+
fail("Expected to find `"+exp+"` Module (found "+count+" others)");
33+
assertEquals(1, count);
34+
}
35+
}

blackbird/src/test/java/module-info.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@
3939
opens tools.jackson.module.blackbird.tofix;
4040
opens tools.jackson.module.blackbird.testutil;
4141
opens tools.jackson.module.blackbird.testutil.failure;
42+
43+
provides tools.jackson.databind.JacksonModule with
44+
tools.jackson.module.blackbird.BlackbirdModule;
45+
uses tools.jackson.databind.JacksonModule;
4246
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package tools.jackson.module.blackbird;
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 BlackbirdTestBase
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 = BlackbirdModule.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+
}

jakarta-xmlbind/src/test/java/module-info.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@
2525
opens tools.jackson.module.jakarta.xmlbind.testutil.failure;
2626
opens tools.jackson.module.jakarta.xmlbind.tofix;
2727
opens tools.jackson.module.jakarta.xmlbind.types;
28+
29+
provides tools.jackson.databind.JacksonModule with
30+
tools.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule;
31+
uses tools.jackson.databind.JacksonModule;
2832
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package tools.jackson.module.jakarta.xmlbind;
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 ModuleTestBase
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 = JakartaXmlBindAnnotationModule.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+
}

mrbean/src/test/java/module-info.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@
2020

2121
// Further, need to open up some packages for JUnit et al
2222
opens tools.jackson.module.mrbean;
23+
24+
provides tools.jackson.databind.JacksonModule with
25+
tools.jackson.module.mrbean.MrBeanModule;
26+
uses tools.jackson.databind.JacksonModule;
2327
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package tools.jackson.module.mrbean;
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 BaseTest
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 = MrBeanModule.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)