File tree 1 file changed +22
-0
lines changed
src/test/java/com/gotocompany/depot/maxcompute/converter/mapper/casted
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 5
5
import com .aliyun .odps .type .TypeInfo ;
6
6
import com .google .protobuf .Descriptors ;
7
7
import com .gotocompany .depot .config .MaxComputeSinkConfig ;
8
+ import com .gotocompany .depot .exception .InvalidMessageException ;
8
9
import org .junit .Before ;
9
10
import org .junit .Test ;
10
11
import org .junit .jupiter .api .Assertions ;
@@ -48,4 +49,25 @@ public void shouldMapProtoFloatValue() {
48
49
49
50
Assertions .assertEquals (input , result .floatValue ());
50
51
}
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
+ }
51
73
}
You can’t perform that action at this time.
0 commit comments