### Question:
ThreadLocalIndex { public int getAndIncrement() { Integer index = this.threadLocalIndex.get(); if (null == index) { index = Math.abs(random.nextInt()); if (index < 0) { index = 0; } this.threadLocalIndex.set(index); } index = Math.abs(index + 1); if (index < 0) { index = 0; } this.threadLocalIndex.set(index); return index; }  int getAndIncrement(); @Override String toString();  }### Answer:
@Test public void testGetAndIncrement() throws Exception { ThreadLocalIndex localIndex = new ThreadLocalIndex(); int initialVal = localIndex.getAndIncrement(); assertThat(localIndex.getAndIncrement()).isEqualTo(initialVal + 1); }