@@ -0,0 +1,2489 @@
+/**%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.encoding;%0A%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aabstract public class LongEncoderTestBase %7B%0A    static protected class TestElement %7B%0A        private final long longVal;%0A        private final Number number;%0A        private final String string;%0A%0A        public TestElement(String s, Number n) %7B%0A            this.longVal = n.longValue();%0A            this.number = n;%0A            this.string = s;%0A        %7D%0A%0A        @Override%0A        public String toString() %7B%0A            return String.format(%22(%25d, %25s, %25s)%22, longVal, number, string);%0A        %7D%0A    %7D%0A%0A    protected final LongEncoderBase ENCODER;%0A    protected final TestElement%5B%5D TEST_CASES;%0A%0A    public LongEncoderTestBase(LongEncoderBase encoder, TestElement%5B%5D testElements) %7B%0A        this.ENCODER = encoder;%0A        this.TEST_CASES = testElements;%0A    %7D%0A%0A    protected String encodeAndDecode(String str) %7B%0A        final long val = ENCODER.encodeFromObject(str);%0A        return ENCODER.decodeToString(val);%0A    %7D%0A%0A%0A    @Test%0A    public void encodingToLong() %7B%0A        for(TestElement t : TEST_CASES) %7B%0A            final long encodeFromNum = ENCODER.encodeFromObject(t.number);%0A            final long encodeFromStr = ENCODER.encodeFromObject(t.string);%0A            assertEquals(%22Number-%3Elong: %22 + t, t.longVal, encodeFromNum);%0A            assertEquals(%22String-%3Elong: %22 + t, t.longVal, encodeFromStr);%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void decodingToString() %7B%0A        for(TestElement t : TEST_CASES) %7B%0A            final String decoded = ENCODER.decodeToString(t.longVal);%0A            assertEquals(%22long-%3EString: %22 + t, t.string, decoded);%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void nullIsZero() %7B%0A        assertEquals(0, ENCODER.encodeFromObject(null));%0A        assertEquals(%220000%22, ENCODER.decodeToString(0));%0A    %7D%0A%7D%0A

Add base class for LongEncoder based tests.