-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New abstract rate strategy #3
Open
tuf65651
wants to merge
26
commits into
CIScapstone:master
Choose a base branch
from
kmbosworth321:newAbstractRateStrategy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
New abstract rate strategy #3
tuf65651
wants to merge
26
commits into
CIScapstone:master
from
kmbosworth321:newAbstractRateStrategy
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implement emptyReturnsTotalEntered test to check if paystation.empty() method returns total amount entered. currently RED (test fails)
- Add to interface - Add to Impl - Ensure returns total inserted so far makes emptyReturnsTotalEntered() test GREEN
Add test case to ensure cancel method does not include any coins in a cancelled transaction when it returns the total value. Test is RED
I'm the worst
Access modifiers (public, private, etc.) in interfaces are redundant.
From void to Map<Integer, Integer>. Also return the appropriate typed object in implementation so that build does not fail.
insertedMap is a HashMap<Integer, Integer> recording the coin types and their respective quantities entered.
To reflect change in return type.
In 'cancel,' supposed to make a deep copy of the insertedMap but made a shallow copy instead. This fixes that.
Into two separate tests: shouldClearAfterCancel and shouldClearMapAfterCancel, to match requirements.
Empty is dependent on buy(). Without a call to buy(), the coin amounts are not collected. These rewrite addresses that requirement. Tests are now RED.
Add totalCollected which only accrues value after a call to buy() as per requirements. Reset totalCollected after call to empty(). Both tests written for empty() are now GREEN.
Add emptyResetsTotalCollected() test. Temporarily comment out totalCollected set to 0 in empty() in Impl to demonstrate test in fail state. Test is currently RED.
Uncomment relevant line to fix test. Test is now GREEN.
Add test to check that map of coins is cleared after a call to buy(). Comment out code in Impl to demonstrate fail state. Test is currently RED.
Reimplement insertedMap.clear() inside reset() method of Impl to clear map after call to cancel() or buy() Test is now GREEN
Test cases: No money, base case, 10 cents, into second hour, into third hour.
My last tests assumed a constructor for Pay Station that takes Rate Strategy as a parameter. I see that this might not be the best say to configure an instance's default. If we never implement that constructor, just implement the instance method to set rate strategy and I'll make the test use that instead. |
Test cases: No money, base case, 10 cents, into second hour, into third hour.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.