Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMike B
10,424 PointsThe Action aspect of the AAA in junit
Referring to Craig's example with refunding money, I'm confused over what is considered an "action". In the first test, addingFunds() was an action (this makes cents to me...get it?..cents...nevermind) but in the second test addingFunds() is part of the Arranging. Shouldn't addingFunds() be an action?
1 Answer
Miguel Canas
Python Development Techdegree Student 11,470 PointsAll the A's should be relative to the individual test case that you're creating. So let's consider the test cases.
In the first test case, we wanted to test that adding funds increments the available funds. In order to do that we needed to:
- Arrange our test case by instantiating the Creditor class,
- Act by calling the addFunds() method, and
- Assert by asserting that addFunds() does in fact add the expected amount.
But in the second test case, we want to test that refunding returns all available funds. This test case implies that available funds should be available in order for the test to case to be valid. In order to do that we needed to:
- Arrange our test by instantiating the Creditor class and calling addFunds() to add to the available funds.
- Act by calling the refund() method, and
- Assert by asserting that the result of calling the refund() method resets the available funds to zero.