//and this payment failed
counter.pay("cc", false);
//As you see we had a total of 4 payments, one credit card payment, 2 ec payments and one paypal. Let's test it:
//this code is just to test the results, you don't need to repeat it in your code, the counters will show up in the webui.
IProducerRegistryAPI registry = new ProducerRegistryAPIFactory().createProducerRegistryAPI();
//check successes
OnDemandStatsProducer<CounterStats> successProducer = (OnDemandStatsProducer<CounterStats>)registry.getProducer("PaymentCounterByParameter.success");
assertNotNull(successProducer);
assertEquals(4, successProducer.getDefaultStats().get());