public int incRefToStream(final int streamId) { return refCountByStreamIdMap.incrementAndGet(streamId); }
@Test public void shouldResultInNotEmptyAfterIncAndDecWhenHaveKey() { map.put(1, 1); map.incrementAndGet(1); map.decrementAndGet(1); assertEquals(1, map.get(1)); assertEquals(1, map.size()); }
@Test public void shouldRemoveEntryAfterIncToInitialVal() { map.put(1, INITIAL_VALUE - 1); map.incrementAndGet(1); assertEquals(INITIAL_VALUE, map.get(1)); assertTrue(map.isEmpty()); assertFalse(map.containsKey(1)); }
@Test public void shouldResultInEmptyAfterIncAndDecWhenEmpty() { map.incrementAndGet(1); map.decrementAndGet(1); assertTrue(map.isEmpty()); map.getAndIncrement(1); map.getAndDecrement(1); assertTrue(map.isEmpty()); map.incrementAndGet(1); map.getAndDecrement(1); assertTrue(map.isEmpty()); map.getAndIncrement(1); map.decrementAndGet(1); assertTrue(map.isEmpty()); }
@Test public void shouldContainValueForIncAndDecEntries() { map.incrementAndGet(1); map.getAndIncrement(2); map.getAndAdd(3, 2); map.addAndGet(4, 3); map.decrementAndGet(5); map.getAndDecrement(6); assertTrue(map.containsKey(1)); assertTrue(map.containsKey(2)); assertTrue(map.containsKey(3)); assertTrue(map.containsKey(4)); assertTrue(map.containsKey(5)); assertTrue(map.containsKey(6)); }
public int incRefToStream(final int streamId) { return refCountByStreamIdMap.incrementAndGet(streamId); }
public int incRefToStream(final int streamId) { return refCountByStreamIdMap.incrementAndGet(streamId); }