parent
ca4de8f191
commit
bbf3c6ecac
|
|
@ -7,7 +7,7 @@ javaPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(platform("com.fasterxml.jackson:jackson-bom:2.14.3"))
|
api(platform("com.fasterxml.jackson:jackson-bom:2.15.2"))
|
||||||
api(platform("io.micrometer:micrometer-bom:1.10.8"))
|
api(platform("io.micrometer:micrometer-bom:1.10.8"))
|
||||||
api(platform("io.netty:netty-bom:4.1.93.Final"))
|
api(platform("io.netty:netty-bom:4.1.93.Final"))
|
||||||
api(platform("io.netty:netty5-bom:5.0.0.Alpha5"))
|
api(platform("io.netty:netty5-bom:5.0.0.Alpha5"))
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -30,8 +30,6 @@ import com.fasterxml.jackson.databind.util.TokenBuffer;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
|
||||||
import org.junit.jupiter.params.provider.ValueSource;
|
|
||||||
import org.skyscreamer.jsonassert.JSONAssert;
|
import org.skyscreamer.jsonassert.JSONAssert;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.test.StepVerifier;
|
import reactor.test.StepVerifier;
|
||||||
|
|
@ -317,12 +315,11 @@ public class Jackson2TokenizerTests extends AbstractLeakCheckingTests {
|
||||||
.verify();
|
.verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@Test
|
||||||
@ValueSource(booleans = {false, true})
|
public void useBigDecimalForFloats() {
|
||||||
public void useBigDecimalForFloats(boolean useBigDecimalForFloats) {
|
|
||||||
Flux<DataBuffer> source = Flux.just(stringBuffer("1E+2"));
|
Flux<DataBuffer> source = Flux.just(stringBuffer("1E+2"));
|
||||||
Flux<TokenBuffer> tokens = Jackson2Tokenizer.tokenize(
|
Flux<TokenBuffer> tokens = Jackson2Tokenizer.tokenize(
|
||||||
source, this.jsonFactory, this.objectMapper, false, useBigDecimalForFloats, -1);
|
source, this.jsonFactory, this.objectMapper, false, true, -1);
|
||||||
|
|
||||||
StepVerifier.create(tokens)
|
StepVerifier.create(tokens)
|
||||||
.assertNext(tokenBuffer -> {
|
.assertNext(tokenBuffer -> {
|
||||||
|
|
@ -331,12 +328,7 @@ public class Jackson2TokenizerTests extends AbstractLeakCheckingTests {
|
||||||
JsonToken token = parser.nextToken();
|
JsonToken token = parser.nextToken();
|
||||||
assertThat(token).isEqualTo(JsonToken.VALUE_NUMBER_FLOAT);
|
assertThat(token).isEqualTo(JsonToken.VALUE_NUMBER_FLOAT);
|
||||||
JsonParser.NumberType numberType = parser.getNumberType();
|
JsonParser.NumberType numberType = parser.getNumberType();
|
||||||
if (useBigDecimalForFloats) {
|
assertThat(numberType).isEqualTo(JsonParser.NumberType.BIG_DECIMAL);
|
||||||
assertThat(numberType).isEqualTo(JsonParser.NumberType.BIG_DECIMAL);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
assertThat(numberType).isEqualTo(JsonParser.NumberType.DOUBLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
catch (IOException ex) {
|
||||||
fail(ex);
|
fail(ex);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue