Pass implements Parcelable { @Nullable static Pass parsePass(JsonValue pass) { String id = pass.optMap().opt(ID_KEY).getString(); String uriString = pass.optMap().opt(PUBLIC_URL_KEY).optMap().opt(PUBLIC_URL_PATH_KEY).getString(); if (!UAStringUtil.isEmpty(uriString)) { Uri url = Uri.parse(uriString); return new Pass(url, id); } Logger.error("Pass - unable to parse URI from %s", pass); return null; } Pass(@NonNull Uri uri, @Nullable String id); protected  Pass(@NonNull Parcel in); @Override void writeToParcel(@NonNull Parcel dest, int flags); @Override int describeContents(); void requestToSavePass(@NonNull Context context); @NonNull Uri getPublicUri(); @Nullable String getId(); @NonNull
    static final Creator<Pass> CREATOR; }
@Test public void testParsePass() throws Exception { String json = "{\n" + " \"createdAt\":\"2016-06-09T18:07:42Z\",\n" + " \"serialNumber\":\"5555555555555555555.55555_5555b5de-555e-555e-55a0-f5be5e5e55b5\",\n" + " \"publicUrl\":{\n" + " \"path\":\"https:\\/\\/goo.gl\\/app\\/pay?link=https:\\/\\/www.android.com\\/payapp\\/savetoandroidpay\\/555\",\n" + " \"type\":\"Single\"\n" + " },\n" + " \"id\":\"5\",\n" + " \"templateId\":\"49581\",\n" + " \"url\":\"https:\\/\\/wallet-api.urbanairship.com\\/v1\\/pass\\/5\\/download\",\n" + " \"updatedAt\":\"2016-06-09T18:07:42Z\",\n" + " \"tags\":[\n" + " \n" + " ],\n" + " \"status\":\"not_been_installed\"\n" + "}"; Pass pass = Pass.parsePass(JsonValue.parseString(json)); assertNotNull(pass); assertEquals(pass.getId(), "5"); assertEquals(pass.getPublicUri(), Uri.parse("https: }