Skip to content

Commit cad9429

Browse files
committed
Another cherry pick from #4759
1 parent 35b14c9 commit cad9429

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/BigDecimalForFloatDisabled3133Test.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import java.util.HashMap;
44
import java.util.Map;
55

6-
import org.junit.jupiter.api.Assertions;
76
import org.junit.jupiter.api.Test;
87

98
import com.fasterxml.jackson.annotation.JsonSubTypes;
@@ -12,6 +11,8 @@
1211
import com.fasterxml.jackson.databind.ObjectMapper;
1312
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
1413

14+
import static org.junit.jupiter.api.Assertions.assertTrue;
15+
1516
/**
1617
* Unit test proving that below issue is fixed.
1718
* <p>
@@ -55,11 +56,11 @@ public void testDeserializeWithDifferentOrdering3133() throws Exception
5556
// case 1 : type first
5657
String ordering1 = a2q("{'type': 'MAP','map': { 'doubleValue': 0.1 }}");
5758
TestMapContainer3133 model1 = mapper.readValue(ordering1, TestMapContainer3133.class);
58-
Assertions.assertTrue(model1.getMap().get("doubleValue") instanceof Double);
59+
assertTrue(model1.getMap().get("doubleValue") instanceof Double);
5960

6061
// case 2 : value first
6162
String ordering2 = a2q("{'map': { 'doubleValue': 0.1 }, 'type': 'MAP'}");
6263
TestMapContainer3133 model2 = mapper.readValue(ordering2, TestMapContainer3133.class);
63-
Assertions.assertTrue(model2.getMap().get("doubleValue") instanceof Double);
64+
assertTrue(model2.getMap().get("doubleValue") instanceof Double);
6465
}
6566
}

src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdSubTypes4610Test.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.List;
44

5-
import org.junit.jupiter.api.Assertions;
65
import org.junit.jupiter.api.Test;
76

87
import com.fasterxml.jackson.annotation.*;
@@ -11,8 +10,9 @@
1110
import com.fasterxml.jackson.databind.ObjectMapper;
1211
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
1312

14-
import static org.junit.Assert.fail;
1513
import static org.junit.jupiter.api.Assertions.assertTrue;
14+
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
15+
import static org.junit.jupiter.api.Assertions.fail;
1616

1717
public class ObjectIdSubTypes4610Test extends DatabindTestUtil
1818
{
@@ -43,7 +43,7 @@ public void shouldHandleTypeDefinitionJson() throws Exception {
4343
.without(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)
4444
.readValue(input);
4545

46-
Assertions.assertInstanceOf(NumberTypeDefinition.class, model);
46+
assertInstanceOf(NumberTypeDefinition.class, model);
4747
}
4848

4949
@Test
@@ -56,7 +56,7 @@ public void testRoundTrip() throws Exception {
5656
TypeDefinition model = MAPPER.readerFor(TypeDefinition.class)
5757
.with(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)
5858
.readValue(JSON);
59-
Assertions.assertInstanceOf(NumberTypeDefinition.class, model);
59+
assertInstanceOf(NumberTypeDefinition.class, model);
6060
}
6161

6262
@Test

src/test/java/com/fasterxml/jackson/databind/tofix/CustomObjectKeyDeserializer4680Test.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.util.Map;
44

5+
import org.junit.jupiter.api.Test;
6+
57
import com.fasterxml.jackson.core.type.TypeReference;
68
import com.fasterxml.jackson.databind.DeserializationContext;
79
import com.fasterxml.jackson.databind.KeyDeserializer;
@@ -10,8 +12,7 @@
1012
import com.fasterxml.jackson.databind.module.SimpleModule;
1113
import com.fasterxml.jackson.databind.testutil.failure.JacksonTestFailureExpected;
1214

13-
import org.junit.jupiter.api.Assertions;
14-
import org.junit.jupiter.api.Test;
15+
import static org.junit.jupiter.api.Assertions.assertEquals;
1516

1617
// [databind#4680] Custom key deserialiser registered for `Object.class` is ignored on nested JSON
1718
public class CustomObjectKeyDeserializer4680Test
@@ -58,15 +59,15 @@ public Object deserializeKey(String key, DeserializationContext ctxt) {
5859

5960
// THEN
6061
// depth 1 works as expected
61-
Assertions.assertEquals("Erik", result.get("name_"));
62+
assertEquals("Erik", result.get("name_"));
6263

6364
// before fix, depth 2 does NOT work as expected
6465
Map<String, Object> addressMap = (Map<String, Object>) result.get("address_");
6566
// before fix, null?? Fails here
66-
Assertions.assertEquals("Elvirastr", addressMap.get("street_"));
67+
assertEquals("Elvirastr", addressMap.get("street_"));
6768
Map<String, Object> cityMap = (Map<String, Object>) addressMap.get("city_");
68-
Assertions.assertEquals(1, cityMap.get("id_"));
69-
Assertions.assertEquals("Berlin", cityMap.get("name_"));
69+
assertEquals(1, cityMap.get("id_"));
70+
assertEquals("Berlin", cityMap.get("name_"));
7071
}
7172

7273
}

0 commit comments

Comments
 (0)