### Question:
Parser { static Token parseTemplateToken(final Builder builder, final String s, final String defaultEffectivePattern ) { String paramName, actualPattern, effectivePattern; final int l = s.length(); if( l > 0 && !builder.isLiteral() ) { final int b = ( s.charAt( 0 ) == TEMPLATE_OPEN_MARKUP ? 1 : -1 ); final int e = ( s.charAt( l-1 ) == TEMPLATE_CLOSE_MARKUP ? l-1 : -1 ); if( ( b > 0 ) && ( e > 0 ) && ( e > b ) ) { final int i = s.indexOf( NAME_PATTERN_SEPARATOR, b ); if( i < 0 ) { paramName = s.substring( b, e ); actualPattern = null; if( Segment.GLOB_PATTERN.equals( paramName ) ) { effectivePattern = Segment.GLOB_PATTERN; } else { effectivePattern = defaultEffectivePattern; } } else { paramName = s.substring( b, i ); actualPattern = s.substring( i+1, e ); effectivePattern = actualPattern; } } else { paramName = Segment.ANONYMOUS_PARAM; actualPattern = s; effectivePattern = actualPattern; } } else { paramName = Segment.ANONYMOUS_PARAM; actualPattern = s; effectivePattern = actualPattern; } return new Token( paramName, actualPattern, effectivePattern, builder.isLiteral() ); }  @Deprecated static Template parse( String template ); static Template parseTemplate( final String template ); static Template parseLiteral( final String literal ); static final char TEMPLATE_OPEN_MARKUP; static final char TEMPLATE_CLOSE_MARKUP; static final char NAME_PATTERN_SEPARATOR; }### Answer:
@Test public void testParseTemplateToken() { Builder builder; String input; Token output; builder = new Builder( "" ); input = "{"; output = Parser.parseTemplateToken( builder, input, "~" ); assertThat( output.getParameterName(), is( "" ) ); assertThat( output.getOriginalPattern(), is( "{" ) ); assertThat( output.getEffectivePattern(), is( "{" ) ); input = "}"; output = Parser.parseTemplateToken( builder, input, "~" ); assertThat( output.getParameterName(), is( "" ) ); assertThat( output.getOriginalPattern(), is( "}" ) ); assertThat( output.getEffectivePattern(), is( "}" ) ); input = "{X"; output = Parser.parseTemplateToken( builder, input, "~" ); assertThat( output.getParameterName(), is( "" ) ); assertThat( output.getOriginalPattern(), is( "{X" ) ); assertThat( output.getEffectivePattern(), is( "{X" ) ); input = "X}"; output = Parser.parseTemplateToken( builder, input, "~" ); assertThat( output.getParameterName(), is( "" ) ); assertThat( output.getOriginalPattern(), is( "X}" ) ); assertThat( output.getEffectivePattern(), is( "X}" ) ); input = "X"; output = Parser.parseTemplateToken( builder, input, "~" ); assertThat( output.getParameterName(), is( "" ) ); assertThat( output.getOriginalPattern(), is( "X" ) ); assertThat( output.getEffectivePattern(), is( "X" ) ); input = "$"; output = Parser.parseTemplateToken( builder, input, "~" ); assertThat( output.getParameterName(), is( "" ) ); assertThat( output.getOriginalPattern(), is( "$" ) ); assertThat( output.getEffectivePattern(), is( "$" ) ); input = ""; output = Parser.parseTemplateToken( builder, input, Segment.GLOB_PATTERN ); assertThat( output.getParameterName(), is( "" ) ); assertThat( output.getOriginalPattern(), is( "" ) ); assertThat( output.getEffectivePattern(), is( "" ) ); }