### Question:
SyncState { public void clearSyncTarget() { replaceSyncTarget(Optional.empty()); } SyncState(final Blockchain blockchain, final EthPeers ethPeers); long subscribeInSync(final InSyncListener listener); long subscribeInSync(final InSyncListener listener, final long syncTolerance); boolean unsubscribeInSync(final long subscriberId); long subscribeSyncStatus(final SyncStatusListener listener); boolean unsubscribeSyncStatus(final long listenerId); Optional<SyncStatus> syncStatus(); Optional<SyncTarget> syncTarget(); void setSyncTarget(final EthPeer peer, final BlockHeader commonAncestor); void setWorldStateDownloadStatus(final WorldStateDownloadStatus worldStateDownloadStatus); boolean isInSync(); boolean isInSync(final long syncTolerance); void disconnectSyncTarget(final DisconnectReason reason); void clearSyncTarget(); long bestChainHeight(); long bestChainHeight(final long localChainHeight);  }### Answer:
@Test public void shouldSwitchToInSyncWhenNoBetterPeersAreAvailable() { setupOutOfSyncState(); otherPeer.disconnect(DisconnectReason.REQUESTED); syncTargetPeer.disconnect(DisconnectReason.REQUESTED); syncState.clearSyncTarget(); verify(inSyncListener).onInSyncStatusChange(true); verify(inSyncListenerExact).onInSyncStatusChange(true); verifyNoMoreInteractions(inSyncListener); verifyNoMoreInteractions(inSyncListenerExact); }