@Test public void testIncrementStream() { ObjectId streamId = new ObjectId(); counter.countUpStream(streamId, 100); counter.incrementStream(streamId); int res = counter.getStreamCounts().get(streamId.toString()); assertEquals(101, res); }
@Test public void testGetStreamCounts() { ObjectId stream1 = new ObjectId(); ObjectId stream2 = new ObjectId(); ObjectId stream3 = new ObjectId(); Map expected = new HashMap<String, Integer>(); expected.put(stream1.toString(), 1); expected.put(stream2.toString(), 5); expected.put(stream3.toString(), 2); counter.countUpStream(stream1, 1); counter.countUpStream(stream2, 3); counter.countUpStream(stream2, 2); counter.countUpStream(stream3, 1); counter.incrementStream(stream3); assertEquals(expected, counter.getStreamCounts()); }