Function counting time is called via JUnit

I want to count how many times I do HTTP GET when I use websockets and when I do not use websockets. I expect once when using websockets and n times otherwise. I want to do this through JUnit, and I use Spring too. Are there any creative ways to count the time when I do a GET with a jersey?

client.target(.....).get(....)

I don’t know how to do this without cluttering up my production code with test code.

+4
source share
2 answers

If the code is defined using an interface, I would use the Decorator pattern to add additional behavior. In this case, additional behavior will track the number of calls.

, Spring. Spring JUnit , Decorated. .

+3

COUNT - . , .

+1

All Articles