Notice how you have to stub out the http library when what you really want to do is check that the right parsing/counting is happening. This is a strong hint that your class has a few too many responsibilities.