[TEST] fix float comparison in RandomObjects#getExpectedParsedValue
This commit fixes a test bug introduced with #36597. This caused some test failure as stored field values comparisons would not work when CBOR xcontent type was used. Closes #29080
This commit is contained in:
parent
3dd5a5a3c5
commit
f1e1f93943
|
@ -135,14 +135,17 @@ public final class RandomObjects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (value instanceof Float) {
|
if (value instanceof Float) {
|
||||||
|
if (xContentType == XContentType.CBOR) {
|
||||||
|
//with CBOR we get back a float
|
||||||
|
return value;
|
||||||
|
}
|
||||||
if (xContentType == XContentType.SMILE) {
|
if (xContentType == XContentType.SMILE) {
|
||||||
//with SMILE we get back a double (this will change in Jackson 2.9 where it will return a Float)
|
//with SMILE we get back a double (this will change in Jackson 2.9 where it will return a Float)
|
||||||
return ((Float)value).doubleValue();
|
return ((Float)value).doubleValue();
|
||||||
} else {
|
}
|
||||||
//with JSON AND YAML we get back a double, but with float precision.
|
//with JSON AND YAML we get back a double, but with float precision.
|
||||||
return Double.parseDouble(value.toString());
|
return Double.parseDouble(value.toString());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (value instanceof Byte) {
|
if (value instanceof Byte) {
|
||||||
return ((Byte)value).intValue();
|
return ((Byte)value).intValue();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue