File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
src/test/java/com/gotocompany/depot/maxcompute/converter/mapper/casted Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 55import com .aliyun .odps .type .TypeInfo ;
66import com .google .protobuf .Descriptors ;
77import com .gotocompany .depot .config .MaxComputeSinkConfig ;
8+ import com .gotocompany .depot .exception .InvalidMessageException ;
89import org .junit .Before ;
910import org .junit .Test ;
1011import org .junit .jupiter .api .Assertions ;
@@ -48,4 +49,25 @@ public void shouldMapProtoFloatValue() {
4849
4950 Assertions .assertEquals (input , result .floatValue ());
5051 }
52+
53+ @ Test (expected = InvalidMessageException .class )
54+ public void shouldThrowInvalidMessageWhenFloatIsPositiveInfinity () {
55+ float value = Float .POSITIVE_INFINITY ;
56+
57+ decimalCastedFloatPrimitiveProtobufMappingStrategy .getProtoPayloadMapperMap ().get (Descriptors .FieldDescriptor .Type .FLOAT ).apply (value );
58+ }
59+
60+ @ Test (expected = InvalidMessageException .class )
61+ public void shouldThrowInvalidMessageWhenFloatIsNegativeInfinity () {
62+ float value = Float .NEGATIVE_INFINITY ;
63+
64+ decimalCastedFloatPrimitiveProtobufMappingStrategy .getProtoPayloadMapperMap ().get (Descriptors .FieldDescriptor .Type .FLOAT ).apply (value );
65+ }
66+
67+ @ Test (expected = InvalidMessageException .class )
68+ public void shouldThrowInvalidMessageWhenFloatIsNaN () {
69+ float value = Float .NaN ;
70+
71+ decimalCastedFloatPrimitiveProtobufMappingStrategy .getProtoPayloadMapperMap ().get (Descriptors .FieldDescriptor .Type .FLOAT ).apply (value );
72+ }
5173}
You can’t perform that action at this time.
0 commit comments