private Object extractMapValue(ReadableMap params, HashMap<String, Object> paramsMap, String key) { Object mapValue; if (ReadableType.Number == params.getType(key)) { try { mapValue = params.getInt(key); } catch (UnexpectedNativeTypeException e) { mapValue = params.getDouble(key); } } else { mapValue = paramsMap.get(key); } return mapValue; }
private void assertUnexpectedTypeExceptionThrown( ReadableArray array, int index, String typeToAskFor) { boolean gotException = false; try { arrayGetByType(array, index, typeToAskFor); } catch (UnexpectedNativeTypeException expected) { gotException = true; } assertTrue(gotException); }
private void assertUnexpectedTypeExceptionThrown( ReadableMap map, String key, String typeToAskFor) { boolean gotException = false; try { mapGetByType(map, key, typeToAskFor); } catch (UnexpectedNativeTypeException expected) { gotException = true; } assertTrue(gotException); }