### Question:
SessionIdFormat { public boolean isValid( @Nullable final String sessionId ) { return sessionId != null && _pattern.matcher( sessionId ).matches(); } 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 testIsValid() throws InterruptedException { final SessionIdFormat cut = new SessionIdFormat(); assertFalse( cut.isValid( "foo" ) ); assertFalse( cut.isValid( "foo.jvm1-n" ) ); assertFalse( cut.isValid( "foo.n.jvm1" ) ); assertFalse( cut.isValid( "foo.n.j-v-m1" ) ); assertTrue( cut.isValid( "foo-n" ) ); assertTrue( cut.isValid( "foo-n.jvm1" ) ); assertTrue( cut.isValid( "foo-n.j-v-m1" ) ); }