}
/**
- * Sets the edition to rescue.
- *
- * @param edition
- * The edition to rescue
- * @return This Sone rescuer
- */
- public void setEdition(long edition) {
- currentEdition = edition;
- }
-
- /**
* Sets whether the last fetch was successful.
*
* @return {@code true} if the last fetch was successful, {@code false}
//
/**
- * Starts the next fetch. If you want to fetch a different edition than “the
- * next older one,” remember to call {@link #setEdition(long)} before
- * calling this method.
+ * Starts the next fetch.
*/
public void startNextFetch() {
fetching = true;
lastFetchSuccessful = (fetchedSone != null);
if (lastFetchSuccessful) {
core.updateSone(fetchedSone, true);
+ currentEdition = getNextEdition();
}
fetching = false;
}
verify(core).updateSone(eq(fetchedSone), eq(true))
assertThat(soneRescuer.isLastFetchSuccessful, equalTo(true))
assertThat(soneRescuer.isFetching, equalTo(false))
+ assertThat(soneRescuer.currentEdition, equalTo(currentEdition - 1))
}
@Test
verify(core, never()).updateSone(any(Sone::class.java), eq(true))
assertThat(soneRescuer.isLastFetchSuccessful, equalTo(false))
assertThat(soneRescuer.isFetching, equalTo(false))
+ assertThat(soneRescuer.currentEdition, equalTo(currentEdition))
}
private fun returnUriOnInsert(fetchedSone: Sone?) {