PrimaryIndexBucketLocatorImpl implements BucketLocator { protected static Long convertTimepointToBucketingLong(Date timepointToBeConverted) { if (timepointToBeConverted == null) { return null; } Long toReturn = timepointToBeConverted.getTime() - PrimaryIndexBucketGeneratorImpl.TIMEPOINT_MIN; if (toReturn < 0l) { return 0l; } else if (toReturn > PrimaryIndexBucketGeneratorImpl.TIMEPOINT_MAX) { return PrimaryIndexBucketGeneratorImpl.TIMEPOINT_MAX; } else { return toReturn; } } private  PrimaryIndexBucketLocatorImpl(); @Deprecated  PrimaryIndexBucketLocatorImpl(List<Long> textBuckets, List<Long> dateTimeBuckets,
            List<Long> doubleBuckets, List<Long> integerBuckets, List<Long> booleanBuckets,
            List<Long> uuidBuckets, List<Long> binaryBuckets, List<Long> longBuckets, List<Long> timepointBuckets); static PrimaryIndexBucketLocatorImpl getInstance(); @Override Long getBucket(Object bucketingObject, FieldDataType dataType); static Long convertObjectToBucketingToken(Object toBeConverted, FieldDataType dataType); static List<Long>[] getBUCKETS();  }
@Test public void testConvertTimepointToBucketingLong() { System.out.println("convertTimepointToBucketingLong"); Date timepointToBeConverted = new Date(); Long expResult = timepointToBeConverted.getTime() - PrimaryIndexBucketGeneratorImpl.TIMEPOINT_MIN; Long result = PrimaryIndexBucketLocatorImpl.convertTimepointToBucketingLong(timepointToBeConverted); assertEquals(expResult, result); timepointToBeConverted = new Date(1893542400000l); result = PrimaryIndexBucketLocatorImpl.convertTimepointToBucketingLong(timepointToBeConverted); assertEquals(PrimaryIndexBucketGeneratorImpl.TIMEPOINT_MAX, result); timepointToBeConverted = new Date(946684800000l); result = PrimaryIndexBucketLocatorImpl.convertTimepointToBucketingLong(timepointToBeConverted); assertEquals(new Long(0l), result); timepointToBeConverted = new Date(); result = PrimaryIndexBucketLocatorImpl.convertTimepointToBucketingLong(timepointToBeConverted); timepointToBeConverted = new Date(timepointToBeConverted.getTime() + 1); Long result2 = PrimaryIndexBucketLocatorImpl.convertTimepointToBucketingLong(timepointToBeConverted); Assert.assertNotEquals(result, result2); }