SimplePaginationTokenEncoder implements PaginationTokenEncoder { @Override public <T> Optional<T> extractLastKey(String paginationToken, Class<T> clazz) { return extractKey(paginationToken, LAST_KEY, clazz); }  @Override String encode(Object firstKey, Object lastKey); @Override Optional<T> extractFirstKey(String paginationToken, Class<T> clazz); @Override Optional<T> extractLastKey(String paginationToken, Class<T> clazz); @Override Optional<String> extractFirstKey(String paginationToken); @Override Optional<String> extractLastKey(String paginationToken);  }
@Test public void testDecodeLastInvalid() { Optional<String> actual = sut.extractLastKey("1"); assertThat(actual.isPresent(), is(false)); }