Skip to content

feat: adds Kimberlee's Lesson 17-Applying SOLID Principles: Enhancing an ATM Simulator #546

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

Closed
wants to merge 15 commits into from

Conversation

haldanek
Copy link
Contributor

@haldanek haldanek commented Nov 5, 2024

Running Log of my attempt to complete this assignment

I chose to complete the first two functional requirements:

Functional Requirement 1:
Since the checking account functions the same as the savings account and none of the checking account tests had anything to do with checkwriting, I copied the tests from the checking account and applied them to the savings account by making a new savings account java file and test file. Tests passed, coverage-87%.

Functional Requirement 2:

  • I modified the customer file by adding a boolean isBusiness to check if any owner in the account is a business.
  • I created a businesscheckingaccount file and test file. Created a validation check in the BCA file to ensure at least one of the owners is a business, if not the code will throw an exception. Used (owners.stream().anyMatch(Customer::isBusiness)). Owners.stream() - converts the owners set(set) into a stream that allows you to perform operations on the collection in a functional, pipeline way. anyMatch… - For each customer object in the stream, any match calls the isBusiness method. If any customer has isBusiness set to true, anyMatch returns true. If no customer has isBusiness set to true, anyMatch returns false. (Got this code from ChatGPT).
  • I modified the BankATM file to integrate the BCA process. The modified code allows you to choose to create a BCA if any owner is a business.
  • I reused tests from the checking account and added 2 new ones.
  • I created a test for the business ownership validation that tests if the account is a business owner. If true, proceed. If false, throw an IllegalArgumentException. (Intial test failed, working out bugs).
  • I realized that I violated the assignment guidelines by creating a new method in BankAtm. To bypass this, I took out the new method and extended the addchecking to include the validation. I also added the IllegalArgumentException file. I also removed all the duplicate tests since BCA is now an extension of addchecking. However, the tests are still failing and I need to find out why.
  • So, I figured out that I never initialized the bankAtm so the test kept failing. I fixed that and the test passed.
  • The businesscheckingaccounttest kept failing no matter what I did. (Here is where I face palm.) I was validating whether it was necessary to open a businesscheckingaccount as an extension of the checking account by checking if any of the owners returned as business owners. I kept the two customers already set as examples (who were set to false) but never included a third customer(set to true) to check if the test works. I created a third customer, ran the test and it passed.

Final Results
Tests: All passed
Coverage: 100%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants