r25728 - Only increment skill usage for successes. (fia/pull/56']#56) * Only increment skill usage for s

Github Bot

Poster of Commits
Only increment skill usage for successes. (#56)

* Only increment skill usage for successes.

Thanks to phreddrickk @ kolmafia.us for reporting this issue.

This adds an example of how one might use Mockito to inject a custom
response. It's not super-well-documented, but I promise all the bits
are necessary.

In particular: we need to set session ID or else GenericRequest.run()
will short-circuit, and we need to set max / current MP and "learn"
the skill so UseSkillRequest.run() won't reject it before even passing
it on to GenericRequest.

These test cases follow the standard arrange / act / assert model.

* Add a RequestTestBase for common setup / helpers.

Right now, this provides some testing the happy path: you specify some
response text for a spy, and we inject that data when you execute
spy.run().

Important: in order for everything to work end-to-end, you need to
provide a spy, not a regular mock. This allows us to exercise as much
real behavior as possible.

View on Github
 
Top