@Test
    public void requireThatNumberCompressCorrectly() {
        byte [] zero = {0};
        verifyNumber(0, zero);
        byte [] one = {0x01};
        verifyNumber(1, one);
        byte [] x1f = {0x1f};
        verifyNumber(0x1f, x1f);
        byte [] x20 = {0x40,0x20};
        verifyNumber(0x20, x20);
        byte [] x1fff = {0x5f, (byte)0xff};
        verifyNumber(0x1fff, x1fff);
        byte [] x2000 = {0x60, 0x00, 0x20, 0x00};
        verifyNumber(0x2000, x2000);
        byte [] x1fffffff = {0x7f, (byte)0xff, (byte)0xff, (byte)0xff};
        verifyNumber(0x1fffffff, x1fffffff);
        byte [] x20000000 = {0,0,0,0};
        assertEquals("Number '536870912' too big, must extend encoding",
                     assertThrows(IllegalArgumentException.class, () -> verifyNumber(0x20000000, x20000000)).getMessage());
        byte [] mzero = {(byte)0x81};
        verifyNumber(-1, mzero);
        byte [] mone = {(byte)0x82};
        verifyNumber(-2, mone);
        byte [] mx1f = {(byte)0x9f};
        verifyNumber(-0x1f, mx1f);
        byte [] mx20 = {(byte)0xc0,0x20};
        verifyNumber(-0x20, mx20);
        byte [] mx1fff = {(byte)0xdf, (byte)0xff};
        verifyNumber(-0x1fff, mx1fff);
        byte [] mx2000 = {(byte)0xe0, 0x00, 0x20, 0x00};
        verifyNumber(-0x2000, mx2000);
        byte [] mx1fffffff = {(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff};
        verifyNumber(-0x1fffffff, mx1fffffff);
        byte [] mx20000000 = {0,0,0,0};
        assertEquals("Number '-536870912' too big, must extend encoding",
                     assertThrows(IllegalArgumentException.class, () -> verifyNumber(-0x20000000, mx20000000)).getMessage());
        byte [] mx80000000 = {0,0,0,0};
        assertEquals("Number '-2147483647' too big, must extend encoding",
                     assertThrows(IllegalArgumentException.class, () -> verifyNumber(-0x80000000, mx80000000)).getMessage());
    }
Test that integers compresses correctly.

@author baldersheim
vespajlib/src/test/java/com/yahoo/compress/IntegerCompressorTest.java