CursorUpdate extends UpdateValue.Update<CursorObject> { @Override public CursorObject apply(@Nullable CursorObject original) { if (original == null) { LOGGER.debug("original is null, creating new cursor"); original = new CursorObject(key, value); } else { original.setValue(value); } return original; } CursorUpdate(final String key, final String value); @Override CursorObject apply(@Nullable CursorObject original);  }
@Test public void testUpdatesCursor() { final CursorUpdate update = new CursorUpdate("test-notifications", "12345"); final CursorObject original = new CursorObject("test-notifications", "1"); final CursorObject expected = new CursorObject("test-notifications", "12345"); final CursorObject actual = update.apply(original); assertThat(actual).isEqualTo(expected); }
@Test public void testNoOriginal() { final CursorUpdate update = new CursorUpdate("test-notifications", "12345"); final CursorObject expected = new CursorObject("test-notifications", "12345"); final CursorObject actual = update.apply(null); assertThat(actual).isEqualTo(expected); }