@Test
public void testHashCode() {

	AtomicInteger longLivedNextHasCode = ReflectionTestUtil.getFieldValue(
		CentralizedThreadLocal.class, "_longLivedNextHasCode");
	AtomicInteger shortLivedNextHasCode = ReflectionTestUtil.getFieldValue(
		CentralizedThreadLocal.class, "_shortLivedNextHasCode");
	Random random = new Random();
	int longLivedHashCode = random.nextInt();
	int shortLivedHashCode = random.nextInt();
	longLivedNextHasCode.set(longLivedHashCode);
	shortLivedNextHasCode.set(shortLivedHashCode);
	CentralizedThreadLocal<?> longLivedCentralizedThreadLocal =
		new CentralizedThreadLocal<>(false);
	CentralizedThreadLocal<?> shortLivedCentralizedThreadLocal =
		new CentralizedThreadLocal<>(true);
	Assert.assertEquals(
		longLivedHashCode, longLivedCentralizedThreadLocal.hashCode());
	Assert.assertEquals(
		shortLivedHashCode, shortLivedCentralizedThreadLocal.hashCode());
	longLivedCentralizedThreadLocal = new CentralizedThreadLocal<>(false);
	shortLivedCentralizedThreadLocal = new CentralizedThreadLocal<>(true);
	int hashIncrement = ReflectionTestUtil.getFieldValue(
		CentralizedThreadLocal.class, "_HASH_INCREMENT");
	Assert.assertEquals(
		longLivedHashCode + hashIncrement,
		longLivedCentralizedThreadLocal.hashCode());
	Assert.assertEquals(
		shortLivedHashCode + hashIncrement,
		shortLivedCentralizedThreadLocal.hashCode());
	Assert.assertEquals(
		longLivedHashCode + (hashIncrement * 2),
		longLivedNextHasCode.get());
	Assert.assertEquals(
		shortLivedHashCode + (hashIncrement * 2),
		shortLivedNextHasCode.get());
}