Deferred implements ScheduleData { @NonNull @Override public JsonValue toJsonValue() { return JsonMap.newBuilder() .put(URL_KEY, url.toString()) .put(RETRY_ON_TIMEOUT, retryOnTimeout) .build().toJsonValue(); } Deferred(@NonNull URL url, boolean retryOnTimeout); @NonNull URL getUrl(); boolean isRetriableOnTimeout(); @NonNull @Override JsonValue toJsonValue(); @NonNull @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) static Deferred fromJson(@NonNull JsonValue jsonValue); @Override boolean equals(Object o); @Override int hashCode(); public URL url; public boolean retryOnTimeout; }
@Test public void testToJSON() throws MalformedURLException { JsonValue expected = JsonMap.newBuilder() .put("url", "https: .put("retry_on_timeout", false) .build() .toJsonValue(); JsonValue toJson = new Deferred(new URL("https: assertEquals(expected, toJson); }