### Question:
MemcachedNodesManager { public String getNextAvailableNodeId(final String nodeId) { String result = nodeId; do { result = _primaryNodeIds.getNextNodeId(result); if(result != null && result.equals(nodeId)) { result = null; } } while(result != null && !isNodeAvailable(result)); return result; } MemcachedNodesManager(final String memcachedNodes, @Nonnull final NodeIdList primaryNodeIds, @Nonnull final List<String> failoverNodeIds,
			@Nonnull final LinkedHashMap<InetSocketAddress, String> address2Ids,
			@Nullable final StorageKeyFormat storageKeyFormat, @Nullable final StorageClientCallback storageClientCallback); @Nonnull static MemcachedNodesManager createFor(final String memcachedNodes, final String failoverNodes, final StorageKeyFormat storageKeyFormat,
            final StorageClientCallback storageClientCallback); String getMemcachedNodes(); int getCountNodes(); @Nonnull NodeIdList getPrimaryNodeIds(); @Nonnull List<String> getFailoverNodeIds(); boolean isEncodeNodeIdInSessionId(); @Nonnull String getNodeId(final InetSocketAddress socketAddress); @CheckForNull String getNextPrimaryNodeId(final String nodeId); String getNextAvailableNodeId(final String nodeId); @Nonnull SessionIdFormat getSessionIdFormat(); @Nonnull StorageKeyFormat getStorageKeyFormat(); @Nonnull List<InetSocketAddress> getAllMemcachedAddresses(); @Nonnull String createSessionId( @Nonnull final String sessionId ); void setNodeAvailable(@Nullable final String nodeId, final boolean available); boolean isNodeAvailable(final String nodeId); boolean isValidForMemcached(final String sessionId); boolean canHitMemcached(final String sessionId); void onLoadFromMemcachedSuccess(final String sessionId); void onLoadFromMemcachedFailure(final String sessionId); String setNodeAvailableForSessionId(final String sessionId, final boolean available); String getNewSessionIdIfNodeFromSessionIdUnavailable( @Nonnull final String sessionId ); String changeSessionIdForTomcatFailover( @Nonnull final String sessionId, final String jvmRoute ); boolean isCouchbaseBucketConfig(); boolean isRedisConfig(); List<URI> getCouchbaseBucketURIs();  }### Answer:
@Test public void testGetNextAvailableNodeId() throws IOException { assertNull(createFor( "n1:localhost:11211", null, null, _mcc ).getNextAvailableNodeId("n1")); assertEquals(createFor( "n1:localhost:11211,n2:localhost:11212", null, null, _mcc ).getNextAvailableNodeId("n1"), "n2"); final StorageClientCallback mcc = mock(StorageClientCallback.class); when(mcc.get(anyString())).thenReturn(null); when(mcc.get(endsWith("n2"))).thenThrow(new OperationTimeoutException("SimulatedException")); assertNull(createFor( "n1:localhost:11211,n2:localhost:11212", null, null, mcc).getNextAvailableNodeId("n1")); assertEquals(createFor( "n1:localhost:11211,n2:localhost:11212,n3:localhost:11213", null, null, mcc).getNextAvailableNodeId("n1"), "n3"); }