File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
google-http-client/src/test/java/com/google/api/client/util Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,25 @@ public void testParsePrimitiveValue() {
242
242
// expected
243
243
}
244
244
assertNull (Data .parsePrimitiveValue (Void .class , "abc" ));
245
+ assertNull (Data .parsePrimitiveValue (Enum .class , null ));
246
+ }
247
+
248
+ private enum MyEnum {
249
+ A ("a" );
250
+ private final String s ;
251
+
252
+ MyEnum (String s ) {
253
+ this .s = s ;
254
+ }
255
+ }
256
+
257
+ public void testParsePrimitiveValueWithUnknownEnum () {
258
+ try {
259
+ Data .parsePrimitiveValue (MyEnum .class , "foo" );
260
+ fail ("expected " + IllegalArgumentException .class );
261
+ } catch (IllegalArgumentException e ) {
262
+ // expected
263
+ }
245
264
}
246
265
247
266
static class Resolve <X , T extends Number > {
You can’t perform that action at this time.
0 commit comments