BigIntegerQuantizer { public static Quantizer<BigInteger> withCompressionFactor(int compressionFactor) { return new CompressingQuantizer(compressionFactor); } BigIntegerQuantizer(); static Quantizer<BigInteger> withCompressionFactor(int compressionFactor);  }
@Test public void testWithCompressionFactor_5() throws Exception { Quantizer<BigInteger> quantizer = BigIntegerQuantizer.withCompressionFactor(5); Assert.assertEquals("0", quantizer.getQuantizedValue(BigInteger.valueOf(0)).toString()); Assert.assertEquals("0", quantizer.getQuantizedValue(BigInteger.valueOf(4)).toString()); Assert.assertEquals("5", quantizer.getQuantizedValue(BigInteger.valueOf(5)).toString()); Assert.assertEquals("5", quantizer.getQuantizedValue(BigInteger.valueOf(9)).toString()); Assert.assertEquals("10", quantizer.getQuantizedValue(BigInteger.valueOf(11)).toString()); Assert.assertEquals("0", quantizer.getQuantizedValue(BigInteger.valueOf(-0)).toString()); Assert.assertEquals("0", quantizer.getQuantizedValue(BigInteger.valueOf(-4)).toString()); Assert.assertEquals("-5", quantizer.getQuantizedValue(BigInteger.valueOf(-5)).toString()); Assert.assertEquals("-5", quantizer.getQuantizedValue(BigInteger.valueOf(-9)).toString()); Assert.assertEquals("-10", quantizer.getQuantizedValue(BigInteger.valueOf(-11)).toString()); }
@Test(expected = IllegalArgumentException.class) public void testWithCompressionFactor_1() throws Exception { BigIntegerQuantizer.withCompressionFactor(1); }