Skip to content

Commit 8432556

Browse files
committed
Fix test failures
1 parent 37cda0c commit 8432556

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

afterburner/src/test/java/com/fasterxml/jackson/module/afterburner/deser/convert/CoerceToBooleanTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import com.fasterxml.jackson.annotation.JsonProperty;
1212
import com.fasterxml.jackson.core.JsonParser;
1313
import com.fasterxml.jackson.core.JsonToken;
14-
14+
import com.fasterxml.jackson.core.StreamReadFeature;
1515
import com.fasterxml.jackson.databind.*;
1616
import com.fasterxml.jackson.databind.cfg.CoercionAction;
1717
import com.fasterxml.jackson.databind.cfg.CoercionInputShape;
@@ -55,6 +55,7 @@ public BooleanWrapper(@JsonProperty("ctor") Boolean foo) {
5555

5656
private final ObjectMapper LEGACY_NONCOERCING_MAPPER = afterburnerMapperBuilder()
5757
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
58+
.disable(StreamReadFeature.CLEAR_CURRENT_TOKEN_ON_CLOSE)
5859
.build();
5960

6061
private final ObjectMapper MAPPER_INT_TO_EMPTY; {
@@ -418,10 +419,10 @@ private void _verifyBooleanCoerceFailReason(MismatchedInputException e,
418419
{
419420
verifyException(e, "Cannot coerce ", "Cannot deserialize value of type ");
420421

422+
// 01-Jun-2025, tatu: Now available via exception
423+
assertToken(tokenType, e.getCurrentToken());
421424
JsonParser p = (JsonParser) e.getProcessor();
422425

423-
assertToken(tokenType, p.currentToken());
424-
425426
final String text = p.getText();
426427
if (!tokenValue.equals(text)) {
427428
String textDesc = (text == null) ? "NULL" : quote(text);

blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/convert/CoerceToBooleanTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import com.fasterxml.jackson.annotation.JsonProperty;
1212
import com.fasterxml.jackson.core.JsonParser;
1313
import com.fasterxml.jackson.core.JsonToken;
14-
14+
import com.fasterxml.jackson.core.StreamReadFeature;
1515
import com.fasterxml.jackson.databind.*;
1616
import com.fasterxml.jackson.databind.cfg.CoercionAction;
1717
import com.fasterxml.jackson.databind.cfg.CoercionInputShape;
@@ -55,6 +55,7 @@ public BooleanWrapper(@JsonProperty("ctor") Boolean foo) {
5555

5656
private final ObjectMapper LEGACY_NONCOERCING_MAPPER = blackbirdMapperBuilder()
5757
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
58+
.disable(StreamReadFeature.CLEAR_CURRENT_TOKEN_ON_CLOSE)
5859
.build();
5960

6061
private final ObjectMapper MAPPER_INT_TO_EMPTY; {
@@ -418,10 +419,10 @@ private void _verifyBooleanCoerceFailReason(MismatchedInputException e,
418419
{
419420
verifyException(e, "Cannot coerce ", "Cannot deserialize value of type ");
420421

421-
JsonParser p = (JsonParser) e.getProcessor();
422-
423-
assertToken(tokenType, p.currentToken());
422+
// 01-Jun-2025, tatu: Now available via exception
423+
assertToken(tokenType, e.getCurrentToken());
424424

425+
JsonParser p = (JsonParser) e.getProcessor();
425426
final String text = p.getText();
426427
if (!tokenValue.equals(text)) {
427428
String textDesc = (text == null) ? "NULL" : quote(text);

0 commit comments

Comments
 (0)