PushImage implements Parcelable { @Nullable @Keep public static PushImage deserialize(@Nullable String pushImage, @NonNull Parser.Factory parser) throws HaloParsingException { if (pushImage != null && parser != null) { try { return ((Parser<InputStream, PushImage>) parser.deserialize(PushImage.class)).convert(new ByteArrayInputStream(pushImage.getBytes())); } catch (IOException e) { throw new HaloParsingException("Error while deserializing the halocontentInstance", e); } } return null; } protected  PushImage(); protected  PushImage(Parcel in); @Api(2.3) @Nullable String getUrl(); @Api(2.3) void setUrl(String url); @Api(2.3) @Nullable @Layout String getLayout(); @Api(2.3) void setLayout(String layout); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); @Nullable @Keep static PushImage deserialize(@Nullable String pushImage, @NonNull Parser.Factory parser); static final String DEFAULT; static final String TOP; static final String LEFT; static final String BOTTOM; static final String RIGHT; static final String BACKGROUND; static final String EXPANDED; static final Creator<PushImage> CREATOR; }
@Test public void thatANullJSONThrowsException() throws JSONException { String pushImageJSON = null; PushImage instance = null; try { instance = PushImage.deserialize(pushImageJSON,mHalo.framework().parser()); } catch (HaloParsingException e) { assertThat(instance).isNull(); } }