So I've integrated GitHub's API using the Egit API wrapper - http://ift.tt/1PhfzdF
Now, I'm aiming to make some proper unit tests and I am thinking that the best way would be to somehow catch outgoing HTTP requests to api.github.com and assert they are correct and never actually allow them to reach Github. So, for example, if I do something like config.getCommitService().getCommits(repo, null, path)
where config is a class containing username, password, repository information, etc, and repo and path are variables I set somewhere, this will fire off a request similar to http://ift.tt/1PzRJgN
Is there some library that can intercept this request and let me assert that it is actually correct? Ideally, I'm looking for something lightweight (small libs), maybe even a solution which doesn't require any external libraries at all.
I tried looking online and but didn't find quite that and I the little I did find seemed a bit complicated for me to follow as it was more generic and not exactly suited for my situation.
Thanks
Aucun commentaire:
Enregistrer un commentaire