Expression { public static Expression createExpressionFromDescribedExpression(String describedExpression) { if (describedExpression != null) { String language = null; String expression = describedExpression; if (describedExpression.matches("[a-zA-Z0-9]+:.+")) { language = describedExpression.substring(0, describedExpression.indexOf(':')); expression = describedExpression.substring(describedExpression.indexOf(':') + 1); } return new Expression(expression, language); } return null; } Expression(String expression, String language);  Expression(String expression);  Expression(Expression toCopy); static Expression createExpressionFromDescribedExpression(String describedExpression); static Expression createExpression(String expression, String language); String getExpression(); String getLanguage(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testCreateExpressionFromDescribedExpression() { Expression expression = Expression.createExpressionFromDescribedExpression("hello"); assertEquals("hello", expression.getExpression()); assertNull(expression.getLanguage()); expression = Expression.createExpressionFromDescribedExpression("there:hello"); assertEquals("hello", expression.getExpression()); assertEquals("there", expression.getLanguage()); expression = Expression.createExpressionFromDescribedExpression("there_:hello"); assertEquals("there_:hello", expression.getExpression()); assertNull(expression.getLanguage()); assertNull(Expression.createExpressionFromDescribedExpression(null)); }