@@ -0,0 +1,2286 @@
+/**%0A * Copyright (C) 2011 Akiban Technologies Inc.%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License, version 3,%0A * as published by the Free Software Foundation.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program.  If not, see http://www.gnu.org/licenses.%0A */%0A%0Apackage com.akiban.server.expression.std;%0A%0Aimport com.akiban.server.error.OverflowException;%0Aimport com.akiban.server.expression.Expression;%0Aimport com.akiban.server.expression.ExpressionEvaluation;%0Aimport com.akiban.server.types.AkType;%0Aimport com.akiban.server.types.NullValueSource;%0Aimport com.akiban.server.types.ValueSource;%0Aimport com.akiban.server.types.util.ValueHolder;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertTrue;%0A%0Apublic final class TruncateStringExpressionTest %7B%0A    protected ValueSource truncate(ValueSource source, int length) %7B%0A        Expression expression = new TruncateStringExpression(length,%0A                                                             new LiteralExpression(source));%0A        return expression.evaluation().eval();%0A    %7D%0A%0A    protected String truncate(String string, int length) %7B%0A        ValueSource source = new ValueHolder(AkType.VARCHAR, string);%0A        ValueSource result = truncate(source, length);%0A        return result.getString();%0A    %7D%0A%0A    @Test%0A    public void testNull() %7B%0A        assertTrue(%22result is null%22, %0A                   truncate(NullValueSource.only(), 128).isNull());%0A    %7D%0A    %0A    @Test%0A    public void testSame() %7B%0A        String value;%0A%0A        value = %22%22;%0A        assertEquals(value, truncate(value, 100));%0A%0A        value = %22some string%22;%0A        assertEquals(value, truncate(value, 100));%0A%0A        value = %22123%22;%0A        assertEquals(value, truncate(value, 3));%0A    %7D%0A%0A    @Test%0A    public void testTruncate() %7B%0A        assertEquals(%22123%22,%0A                     truncate(%22123456%22, 3));%0A    %7D%0A%7D%0A

Add unit test for that.