Skip to content

Commit e955c90

Browse files
committed
Merge branch '2.19'
2 parents 57dd2d2 + dbb5df4 commit e955c90

File tree

8 files changed

+124
-108
lines changed

8 files changed

+124
-108
lines changed

guice/pom.xml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@
5555
<version>${version.guice}</version>
5656
</dependency>
5757

58-
<!-- 20-Apr-2024, tatu: JUnit4 no longer from jackson-base -->
59-
<dependency>
60-
<groupId>junit</groupId>
61-
<artifactId>junit</artifactId>
62-
<scope>test</scope>
63-
</dependency>
58+
<!-- Test dependencies -->
59+
<dependency>
60+
<groupId>org.junit.jupiter</groupId>
61+
<artifactId>junit-jupiter</artifactId>
62+
<scope>test</scope>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.junit.jupiter</groupId>
66+
<artifactId>junit-jupiter-api</artifactId>
67+
<scope>test</scope>
68+
</dependency>
6469

6570
</dependencies>
6671

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
// Additional test lib/framework dependencies
1919

20-
requires junit; // JUnit4 To Be Removed in future
20+
requires org.junit.jupiter.api;
21+
requires org.junit.jupiter.params;
2122

2223
// Further, need to open up some packages for JUnit et al
2324
opens tools.jackson.module.guice;

guice/src/test/java/tools/jackson/module/guice/ExtendInjectableTest.java

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
package tools.jackson.module.guice;
22

3-
import com.fasterxml.jackson.annotation.JacksonInject;
4-
import com.fasterxml.jackson.annotation.JsonCreator;
5-
import com.fasterxml.jackson.annotation.JsonProperty;
3+
import javax.inject.Inject;
64

7-
import tools.jackson.databind.ObjectMapper;
5+
import org.junit.jupiter.api.Test;
86

97
import com.google.inject.Binder;
108
import com.google.inject.Guice;
119
import com.google.inject.Injector;
1210
import com.google.inject.Module;
1311
import com.google.inject.name.Names;
14-
import org.junit.Assert;
15-
import org.junit.Test;
1612

17-
import javax.inject.Inject;
13+
import com.fasterxml.jackson.annotation.*;
14+
15+
import tools.jackson.databind.ObjectMapper;
16+
17+
import static org.junit.jupiter.api.Assertions.assertEquals;
18+
import static org.junit.jupiter.api.Assertions.assertSame;
1819

1920
/**
2021
*/
@@ -64,30 +65,30 @@ public void configure(Binder binder)
6465

6566
final ReadableBean bean = mapper.readValue("{\"constructor_value\":\"myConstructor\",\"field_value\":\"myField\",\"method_value\":\"myMethod\"}", ReadableBean.class);
6667

67-
Assert.assertEquals("myConstructor", bean.constructorValue);
68-
Assert.assertEquals("myMethod", bean.methodValue);
69-
Assert.assertEquals("myField", bean.fieldValue);
68+
assertEquals("myConstructor", bean.constructorValue);
69+
assertEquals("myMethod", bean.methodValue);
70+
assertEquals("myField", bean.fieldValue);
7071

7172
verifyInjections("From Jackson's ObjectMapper", bean);
7273

7374
}
7475

7576
private void verifyInjections(String message, InjectableBean injected)
7677
{
77-
Assert.assertSame(message, constructorInjected, injected.constructorInjected);
78-
Assert.assertSame(message, constructorInjectedWithJavaAnnotation, injected.constructorInjectedWithJavaAnnotation);
79-
Assert.assertSame(message, constructorInjectedWithGuiceAnnotation, injected.constructorInjectedWithGuiceAnnotation);
80-
Assert.assertSame(message, constructorInjectedWithCustomAnnotation, injected.constructorInjectedWithCustomAnnotation);
81-
82-
Assert.assertSame(message, methodInjected, injected.methodInjected);
83-
Assert.assertSame(message, methodInjectedWithJavaAnnotation, injected.methodInjectedWithJavaAnnotation);
84-
Assert.assertSame(message, methodInjectedWithGuiceAnnotation, injected.methodInjectedWithGuiceAnnotation);
85-
Assert.assertSame(message, methodInjectedWithCustomAnnotation, injected.methodInjectedWithCustomAnnotation);
86-
87-
Assert.assertSame(message, fieldInjected, injected.fieldInjected);
88-
Assert.assertSame(message, fieldInjectedWithJavaAnnotation, injected.fieldInjectedWithJavaAnnotation);
89-
Assert.assertSame(message, fieldInjectedWithGuiceAnnotation, injected.fieldInjectedWithGuiceAnnotation);
90-
Assert.assertSame(message, fieldInjectedWithCustomAnnotation, injected.fieldInjectedWithCustomAnnotation);
78+
assertSame(constructorInjected, injected.constructorInjected);
79+
assertSame(constructorInjectedWithJavaAnnotation, injected.constructorInjectedWithJavaAnnotation);
80+
assertSame(constructorInjectedWithGuiceAnnotation, injected.constructorInjectedWithGuiceAnnotation);
81+
assertSame(constructorInjectedWithCustomAnnotation, injected.constructorInjectedWithCustomAnnotation);
82+
83+
assertSame(methodInjected, injected.methodInjected);
84+
assertSame(methodInjectedWithJavaAnnotation, injected.methodInjectedWithJavaAnnotation);
85+
assertSame(methodInjectedWithGuiceAnnotation, injected.methodInjectedWithGuiceAnnotation);
86+
assertSame(methodInjectedWithCustomAnnotation, injected.methodInjectedWithCustomAnnotation);
87+
88+
assertSame(fieldInjected, injected.fieldInjected);
89+
assertSame(fieldInjectedWithJavaAnnotation, injected.fieldInjectedWithJavaAnnotation);
90+
assertSame(fieldInjectedWithGuiceAnnotation, injected.fieldInjectedWithGuiceAnnotation);
91+
assertSame(fieldInjectedWithCustomAnnotation, injected.fieldInjectedWithCustomAnnotation);
9192
}
9293

9394
/* ===================================================================== */

guice/src/test/java/tools/jackson/module/guice/ObjectMapperModuleTest.java

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
import java.math.BigInteger;
44

5+
import org.junit.jupiter.api.Test;
6+
7+
import com.google.inject.Binder;
8+
import com.google.inject.Guice;
9+
import com.google.inject.Injector;
10+
import com.google.inject.Key;
11+
import com.google.inject.Module;
12+
import com.google.inject.name.Names;
13+
514
import com.fasterxml.jackson.annotation.JacksonInject;
615
import com.fasterxml.jackson.annotation.JsonProperty;
716

@@ -12,15 +21,7 @@
1221
import tools.jackson.databind.SerializationContext;
1322
import tools.jackson.databind.module.SimpleModule;
1423

15-
import com.google.inject.Binder;
16-
import com.google.inject.Guice;
17-
import com.google.inject.Injector;
18-
import com.google.inject.Key;
19-
import com.google.inject.Module;
20-
import com.google.inject.name.Names;
21-
22-
import org.junit.Assert;
23-
import org.junit.Test;
24+
import static org.junit.jupiter.api.Assertions.assertEquals;
2425

2526
public class ObjectMapperModuleTest
2627
{
@@ -65,7 +66,7 @@ public void testModulesRegisteredThroughNormalInstantiation() throws Exception
6566

6667
final ObjectMapper mapper = injector.getInstance(ObjectMapper.class);
6768

68-
Assert.assertEquals(mapper.writeValueAsString(Integer.valueOf(10)), "\"A\"");
69+
assertEquals(mapper.writeValueAsString(10), "\"A\"");
6970
}
7071

7172
@Test
@@ -77,7 +78,7 @@ public void testModulesRegisteredThroughInjection() throws Exception
7778

7879
final ObjectMapper mapper = injector.getInstance(ObjectMapper.class);
7980

80-
Assert.assertEquals(mapper.writeValueAsString(Integer.valueOf(10)), "\"A\"");
81+
assertEquals(mapper.writeValueAsString(10), "\"A\"");
8182
}
8283

8384
@Test
@@ -97,7 +98,7 @@ public void configure(Binder binder)
9798

9899
final ObjectMapper mapper = injector.getInstance(ObjectMapper.class);
99100

100-
Assert.assertEquals(mapper.writeValueAsString(Integer.valueOf(10)), "\"A\"");
101+
assertEquals(mapper.writeValueAsString(10), "\"A\"");
101102
}
102103

103104
@Test
@@ -119,7 +120,7 @@ public void configure(Binder binder)
119120

120121
final ObjectMapper mapper = injector.getInstance(ObjectMapper.class);
121122

122-
Assert.assertEquals(mapper.writeValueAsString(Integer.valueOf(10)), "\"A\"");
123+
assertEquals(mapper.writeValueAsString(10), "\"A\"");
123124
}
124125

125126
@Test
@@ -131,7 +132,7 @@ public void testModulesRegisteredThroughInjectionWithKey() throws Exception
131132

132133
final ObjectMapper mapper = injector.getInstance(ObjectMapper.class);
133134

134-
Assert.assertEquals(mapper.writeValueAsString(Integer.valueOf(10)), "\"A\"");
135+
assertEquals(mapper.writeValueAsString(10), "\"A\"");
135136
}
136137

137138
private static class SomeBean
@@ -186,15 +187,15 @@ private void injectNine(long n)
186187

187188
public boolean verify()
188189
{
189-
Assert.assertEquals(1, one);
190-
Assert.assertEquals(2, two);
191-
Assert.assertEquals(3, three);
192-
Assert.assertEquals(4, four);
193-
Assert.assertEquals(5, five);
194-
Assert.assertEquals(6, six);
195-
Assert.assertEquals(7, seven);
196-
Assert.assertEquals(8, eight);
197-
Assert.assertEquals(9, nine);
190+
assertEquals(1, one);
191+
assertEquals(2, two);
192+
assertEquals(3, three);
193+
assertEquals(4, four);
194+
assertEquals(5, five);
195+
assertEquals(6, six);
196+
assertEquals(7, seven);
197+
assertEquals(8, eight);
198+
assertEquals(9, nine);
198199
return true;
199200
}
200201

guice7/pom.xml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@
5555
<version>${version.guice}</version>
5656
</dependency>
5757

58-
<!-- 20-Apr-2024, tatu: JUnit4 no longer from jackson-base -->
59-
<dependency>
60-
<groupId>junit</groupId>
61-
<artifactId>junit</artifactId>
62-
<scope>test</scope>
63-
</dependency>
58+
<!-- Test dependencies -->
59+
<dependency>
60+
<groupId>org.junit.jupiter</groupId>
61+
<artifactId>junit-jupiter</artifactId>
62+
<scope>test</scope>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.junit.jupiter</groupId>
66+
<artifactId>junit-jupiter-api</artifactId>
67+
<scope>test</scope>
68+
</dependency>
6469
</dependencies>
6570

6671
<build>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
// Additional test lib/framework dependencies
1717

18-
requires junit; // JUnit4 To Be Removed in future
18+
requires org.junit.jupiter.api;
19+
requires org.junit.jupiter.params;
1920

2021
// Further, need to open up some packages for JUnit et al
2122
opens tools.jackson.module.guice7;

guice7/src/test/java/tools/jackson/module/guice7/ExtendInjectableTest.java

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
package tools.jackson.module.guice7;
22

3-
import com.fasterxml.jackson.annotation.JacksonInject;
4-
import com.fasterxml.jackson.annotation.JsonCreator;
5-
import com.fasterxml.jackson.annotation.JsonProperty;
3+
import jakarta.inject.Inject;
64

7-
import tools.jackson.databind.ObjectMapper;
5+
import org.junit.jupiter.api.Test;
86

97
import com.google.inject.Binder;
108
import com.google.inject.Guice;
119
import com.google.inject.Injector;
1210
import com.google.inject.Module;
1311
import com.google.inject.name.Names;
14-
import org.junit.Assert;
15-
import org.junit.Test;
1612

17-
import jakarta.inject.Inject;
13+
import com.fasterxml.jackson.annotation.*;
14+
15+
import tools.jackson.databind.ObjectMapper;
16+
17+
import static org.junit.jupiter.api.Assertions.assertEquals;
18+
import static org.junit.jupiter.api.Assertions.assertSame;
1819

1920
public class ExtendInjectableTest
2021
{
@@ -62,30 +63,30 @@ public void configure(Binder binder)
6263

6364
final ReadableBean bean = mapper.readValue("{\"constructor_value\":\"myConstructor\",\"field_value\":\"myField\",\"method_value\":\"myMethod\"}", ReadableBean.class);
6465

65-
Assert.assertEquals("myConstructor", bean.constructorValue);
66-
Assert.assertEquals("myMethod", bean.methodValue);
67-
Assert.assertEquals("myField", bean.fieldValue);
66+
assertEquals("myConstructor", bean.constructorValue);
67+
assertEquals("myMethod", bean.methodValue);
68+
assertEquals("myField", bean.fieldValue);
6869

6970
verifyInjections("From Jackson's ObjectMapper", bean);
7071

7172
}
7273

7374
private void verifyInjections(String message, InjectableBean injected)
7475
{
75-
Assert.assertSame(message, constructorInjected, injected.constructorInjected);
76-
Assert.assertSame(message, constructorInjectedWithJavaAnnotation, injected.constructorInjectedWithJavaAnnotation);
77-
Assert.assertSame(message, constructorInjectedWithGuiceAnnotation, injected.constructorInjectedWithGuiceAnnotation);
78-
Assert.assertSame(message, constructorInjectedWithCustomAnnotation, injected.constructorInjectedWithCustomAnnotation);
79-
80-
Assert.assertSame(message, methodInjected, injected.methodInjected);
81-
Assert.assertSame(message, methodInjectedWithJavaAnnotation, injected.methodInjectedWithJavaAnnotation);
82-
Assert.assertSame(message, methodInjectedWithGuiceAnnotation, injected.methodInjectedWithGuiceAnnotation);
83-
Assert.assertSame(message, methodInjectedWithCustomAnnotation, injected.methodInjectedWithCustomAnnotation);
84-
85-
Assert.assertSame(message, fieldInjected, injected.fieldInjected);
86-
Assert.assertSame(message, fieldInjectedWithJavaAnnotation, injected.fieldInjectedWithJavaAnnotation);
87-
Assert.assertSame(message, fieldInjectedWithGuiceAnnotation, injected.fieldInjectedWithGuiceAnnotation);
88-
Assert.assertSame(message, fieldInjectedWithCustomAnnotation, injected.fieldInjectedWithCustomAnnotation);
76+
assertSame(constructorInjected, injected.constructorInjected);
77+
assertSame(constructorInjectedWithJavaAnnotation, injected.constructorInjectedWithJavaAnnotation);
78+
assertSame(constructorInjectedWithGuiceAnnotation, injected.constructorInjectedWithGuiceAnnotation);
79+
assertSame(constructorInjectedWithCustomAnnotation, injected.constructorInjectedWithCustomAnnotation);
80+
81+
assertSame(methodInjected, injected.methodInjected);
82+
assertSame(methodInjectedWithJavaAnnotation, injected.methodInjectedWithJavaAnnotation);
83+
assertSame(methodInjectedWithGuiceAnnotation, injected.methodInjectedWithGuiceAnnotation);
84+
assertSame(methodInjectedWithCustomAnnotation, injected.methodInjectedWithCustomAnnotation);
85+
86+
assertSame(fieldInjected, injected.fieldInjected);
87+
assertSame(fieldInjectedWithJavaAnnotation, injected.fieldInjectedWithJavaAnnotation);
88+
assertSame(fieldInjectedWithGuiceAnnotation, injected.fieldInjectedWithGuiceAnnotation);
89+
assertSame(fieldInjectedWithCustomAnnotation, injected.fieldInjectedWithCustomAnnotation);
8990
}
9091

9192
/* ===================================================================== */

0 commit comments

Comments
 (0)