### Question:
SessionIdFormat { @Nonnull public String createNewSessionId( @Nonnull final String sessionId, @Nonnull final String newMemcachedId) { final int idxDot = sessionId.indexOf( '.' ); if ( idxDot != -1 ) { final String plainSessionId = sessionId.substring( 0, idxDot ); final String jvmRouteWithDot = sessionId.substring( idxDot ); return appendOrReplaceMemcachedId( plainSessionId, newMemcachedId ) + jvmRouteWithDot; } else { return appendOrReplaceMemcachedId( sessionId, newMemcachedId ); } } SessionIdFormat();  SessionIdFormat(final StorageKeyFormat storageKeyFormat); @Nonnull String createSessionId(@Nonnull final String sessionId, @Nullable final String memcachedId); @Nonnull String createNewSessionId( @Nonnull final String sessionId, @Nonnull final String newMemcachedId); @Nonnull String changeJvmRoute( @Nonnull final String sessionId, @Nonnull final String newJvmRoute ); boolean isValid( @Nullable final String sessionId ); @CheckForNull String extractMemcachedId( @Nonnull final String sessionId ); @CheckForNull String extractJvmRoute( @Nonnull final String sessionId ); @Nonnull String stripJvmRoute( @Nonnull final String sessionId ); @Nonnull String createLockName( @Nonnull final String sessionId ); @Nonnull String createValidityInfoKeyName( @Nonnull final String origKey ); @Nonnull String createBackupKey( @Nonnull final String origKey ); boolean isBackupKey( @Nonnull final String key );  }### Answer:
@Test public void testCreateNewSessionId() { final SessionIdFormat cut = new SessionIdFormat(); assertEquals( "foo-n", cut.createNewSessionId( "foo", "n") ); assertEquals( "foo-m", cut.createNewSessionId( "foo-n", "m" ) ); assertEquals( "foo-m.jvm1", cut.createNewSessionId( "foo-n.jvm1", "m" ) ); assertEquals( "foo-m.jvm1", cut.createNewSessionId( "foo.jvm1", "m" ) ); assertEquals( "foo-m.j-v-m1", cut.createNewSessionId( "foo.j-v-m1", "m" ) ); }