File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
api/all/src/test/java/io/opentelemetry/api/logs Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1313import io .opentelemetry .api .common .KeyValue ;
1414import io .opentelemetry .api .common .Value ;
1515import io .opentelemetry .api .common .ValueType ;
16+ import java .math .BigDecimal ;
17+ import java .math .BigInteger ;
1618import java .nio .ByteBuffer ;
1719import java .nio .ReadOnlyBufferException ;
1820import java .nio .charset .StandardCharsets ;
@@ -271,4 +273,19 @@ private static Stream<Arguments> convertArgs() {
271273 .put ("key3" , Value .of (Collections .singletonMap ("key4" , Value .of ("value" ))))
272274 .build ())));
273275 }
276+
277+ @ ParameterizedTest
278+ @ MethodSource ("convertUnsupportedArgs" )
279+ void convertUnsupported (Object object ) {
280+ assertThatThrownBy (() -> Value .convert (object )).isInstanceOf (IllegalArgumentException .class );
281+ }
282+
283+ private static Stream <Arguments > convertUnsupportedArgs () {
284+ return Stream .of (
285+ Arguments .of (new Object ()),
286+ Arguments .of (new BigInteger ("1" )),
287+ Arguments .of (new BigDecimal ("1.1" )),
288+ Arguments .of (Collections .singletonList (new Object ())),
289+ Arguments .of (Collections .singletonMap (new Object (), "value" )));
290+ }
274291}
You can’t perform that action at this time.
0 commit comments