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