KeyValueServiceCoordinationStore implements CoordinationStore<T> { @Override public Optional<ValueAndBound<T>> getAgreedValue() { return readLatestState().map(CoordinationStoreState::valueAndBound); } @VisibleForTesting  KeyValueServiceCoordinationStore(
            ObjectMapper objectMapper,
            KeyValueService kvs,
            byte[] coordinationRow,
            LongSupplier sequenceNumberSupplier,
            BiPredicate<T, T> shouldReuseExtantValue,
            Class<T> clazz); static CoordinationStore<T> create(
            ObjectMapper objectMapper,
            KeyValueService kvs,
            byte[] coordinationRow,
            LongSupplier sequenceNumberSupplier,
            BiPredicate<T, T> shouldReuseExistingValue,
            Class<T> clazz,
            boolean initializeAsync); @Override boolean isInitialized(); @Override Optional<ValueAndBound<T>> getAgreedValue(); @Override CheckAndSetResult<ValueAndBound<T>> transformAgreedValue(Function<ValueAndBound<T>, T> transform);  }
@Test public void retriesOnKeyValueServiceWhenValuesDeletedInGets() throws JsonProcessingException { KeyValueService mockKvs = mock(KeyValueService.class); KeyValueServiceCoordinationStore<String> store = coordinationStoreForKvs(mockKvs); setupOnceFailingMockKvs(mockKvs, store); assertThat(store.getAgreedValue()).isPresent() .contains(ValueAndBound.of(VALUE_2, SEQUENCE_AND_BOUND_2.bound())); verifyReadsOnOnceFailingMockKvs(mockKvs, store); }
@Test public void getReturnsEmptyIfNoKeyFound() { assertThat(coordinationStore.getAgreedValue()).isEmpty(); }