Skip to content

Commit

Permalink
Create NonStandardNumberParsing4694Test.java (#1334)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning authored Sep 12, 2024
1 parent f90ba05 commit 8e4c3a8
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.fasterxml.jackson.failing;

import com.fasterxml.jackson.core.JUnit5TestBase;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;

class NonStandardNumberParsing4694Test
extends JUnit5TestBase
{
// https://github.com/FasterXML/jackson-databind/issues/4694
@Test
void databind4694() throws Exception {
final String str = "-11000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
final BigDecimal expected = new BigDecimal(str);
for (int mode : ALL_MODES) {
try (JsonParser p = createParser(mode, String.format(" %s ", str))) {
assertEquals(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken());
assertEquals(expected, p.getDecimalValue());
assertFalse(p.isNaN());
}
}
}
}

0 comments on commit 8e4c3a8

Please sign in to comment.