public void testValidateParameters() { Upper upper = Upper.getInstance(); // Verify that Upper does not accept 0 parameters. try { upper.validateParameters(Lists.<ValueType>newArrayList()); fail(); } catch (InvalidQueryException e) { // Do nothing - this is the expected behavior. } // Verify that Upper does not accept more than 1 parameter. try { upper.validateParameters(Lists.newArrayList(ValueType.TEXT, ValueType.TEXT)); fail(); } catch (InvalidQueryException e) { // Do nothing - this is the expected behavior. } // Verify that Upper does not accept a non-Text parameter. try { upper.validateParameters(Lists.newArrayList(ValueType.DATE)); fail(); } catch (InvalidQueryException e) { // Do nothing - this is the expected behavior. } // Verify that Upper accepts 1 TEXT parameter. try { upper.validateParameters(Lists.newArrayList(ValueType.TEXT)); } catch (InvalidQueryException e) { fail(); } }
public void testEvaluate() { Upper upper = Upper.getInstance(); // Test empty string. TextValue textValue = (TextValue) upper.evaluate(Lists.<Value>newArrayList(new TextValue(""))); assertEquals(textValue.getValue(), ""); // Basic test. textValue = (TextValue) upper.evaluate(Lists.<Value>newArrayList(new TextValue("aBc"))); assertEquals(textValue.getValue(), "ABC"); }