### Question:
SimpleCollector { protected double increment(String consumerName, String lifecycle, String propertyPrefix) { if (isTurnedOff(consumerName, lifecycle, propertyPrefix)) return 0.0; return increment(consumerName, lifecycle); } SimpleCollector(); @LifeCycle(value=ProcessStep.Pending) void pending(MessageRunnable mr); @LifeCycle(value=ProcessStep.Validating) void validating(MessageRunnable mr); @LifeCycle(value=ProcessStep.Invalid) void invalid(MessageRunnable mr); @LifeCycle(value=ProcessStep.Processing) void processing(MessageRunnable mr); @LifeCycle(value=ProcessStep.Complete) void complete(MessageRunnable mr); @LifeCycle(value=ProcessStep.Error) void error(MessageRunnable mr); @LifeCycle(value=ProcessStep.Retrying) void retry(MessageRunnable mr); @LifeCycle(value=ProcessStep.MaxRetriesExceeded) void maxRetries(MessageRunnable mr);  }### Answer:
@Test public void testIncrement() { SimpleCollector ddc = new SimpleCollector(); assertEquals(0.0, ddc.increment("", "")); assertEquals(0.0, ddc.increment(null, "abc")); assertEquals(0.0, ddc.increment("abc", null)); assertEquals(0.0, ddc.increment(null, null)); assertEquals(1.0, ddc.increment("queue", "pending")); assertEquals(2.0, ddc.increment("queue", "pending")); assertEquals(1.0, ddc.increment("queue", "complete")); assertEquals(3.0, ddc.increment("queue", "pending")); assertEquals(1.0, ddc.increment("topic", "pending")); assertEquals(2.0, ddc.increment("topic", "pending")); assertEquals(1.0, ddc.increment("topic", "complete")); assertEquals(3.0, ddc.increment("topic", "pending")); }
@Test public void testPropsQueueOn() { SimpleCollector ddc = new SimpleCollector(); assertEquals(1.0, ddc.increment("queue", "pending", "testpropqon")); System.setProperty("testpropqon.pending", "false"); assertEquals(0.0, ddc.increment("queue", "pending", "testpropqon")); System.setProperty("testpropqon.pending.queue", "true"); assertEquals(2.0, ddc.increment("queue", "pending", "testpropqon")); assertEquals(0.0, ddc.increment("queue2", "pending", "testpropqon")); assertEquals(1.0, ddc.increment("queue", "validate", "testpropqon")); System.setProperty("testpropqon.validate.queue", "true"); assertEquals(2.0, ddc.increment("queue", "validate", "testpropqon")); System.setProperty("testpropqon.validate.queue", "on"); assertEquals(0.0, ddc.increment("queue", "validate", "testpropqon")); System.setProperty("testpropqon.validate.queue", "yes"); assertEquals(0.0, ddc.increment("queue", "validate", "testpropqon")); }
@Test public void testPropsQueueOff() { SimpleCollector ddc = new SimpleCollector(); assertEquals(1.0, ddc.increment("queue", "pending", "testpropqoff")); System.setProperty("testpropqoff.pending.queue", "true"); assertEquals(2.0, ddc.increment("queue", "pending", "testpropqoff")); System.setProperty("testpropqoff.pending.queue", "false"); assertEquals(0.0, ddc.increment("queue", "pending", "testpropqoff")); assertEquals(1.0, ddc.increment("queue2", "pending", "testpropqoff")); }