### Question:
SqlQueryParser implements QueryParser { protected StaticOperand parseStaticOperand( TokenStream tokens, TypeSystem typeSystem ) { if (tokens.canConsume('$')) { String value = tokens.consume(); if (!XmlCharacters.isValidNcName(value)) { Position pos = tokens.previousPosition(); String msg = GraphI18n.bindVariableMustConformToNcName.text(value, pos.getLine(), pos.getColumn()); throw new ParsingException(pos, msg); } return bindVariableName(value); } if (tokens.canConsume('(')) { StaticOperand result = parseStaticOperand(tokens, typeSystem); tokens.consume(')'); return result; } if (tokens.matches("SELECT")) { QueryCommand subqueryExpression = parseQueryCommand(tokens, typeSystem); return subquery(subqueryExpression); } return parseLiteral(tokens, typeSystem); }  String getLanguage(); @Override String toString(); @Override boolean equals( Object obj ); QueryCommand parseQuery( String query,
                                    TypeSystem typeSystem ); static final String LANGUAGE; }### Answer:
@Test public void shouldParseStaticOperandFromStringWithBindVariable() { StaticOperand operand = parser.parseStaticOperand(tokens("$VAR"), typeSystem); assertThat(operand, is(instanceOf(BindVariableName.class))); BindVariableName var = (BindVariableName)operand; assertThat(var.variableName(), is("VAR")); }
@Test( expected = ParsingException.class ) public void shouldFailToParseStaticOperandFromStringWithBindVariableWithNoVariableName() { parser.parseStaticOperand(tokens("$"), typeSystem); }
@Test( expected = ParsingException.class ) public void shouldFailToParseStaticOperandFromStringWithBindVariableWithCharactersThatAreNotFromNCName() { parser.parseStaticOperand(tokens("$#2VAR"), typeSystem); }
@Test public void shouldParseStaticOperandFromStringWithLiteralValue() { StaticOperand operand = parser.parseStaticOperand(tokens("CAST(123 AS DOUBLE)"), typeSystem); assertThat(operand, is(instanceOf(Literal.class))); Literal literal = (Literal)operand; assertThat((Double)literal.value(), is(typeSystem.getDoubleFactory().create("123"))); }