AY2425S1-CS2103-F12-1 / tp

MIT License
0 stars 4 forks source link

Add method to check insurance commands and update some test methods. #146

Closed RezwanAhmed123 closed 1 week ago

RezwanAhmed123 commented 1 week ago

Fix testing methods for Insurance and Claim Commands

The testing utilities do not support comparison of states of InsurancePlansManager objects as we purposefully implemented it as a mutable object and did not include this object to the client's equals method.

This causes weird testing behaviours as the expected and intended models used in assertCommandSuccess methods do not really check if the two InsurancePlansManager objects are indeed the same.

Let's introduce a new testing utility to check for changes in InsurancePlanManager objects instead of clients.

This should make the testing alot easier and accurate for commands related to Insurances and Claims.

While using the new tests, uncovered a bug inside close claim command as the plan marks the object itself as false. This may cause weird behaviours if say, two claims with same claimIds exist under different plans.

Let's change this to ensure only the claim inside of the insurance plan.

This should get rid of any weird behaviours.

The following tests were also updated using the new test utility.

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../model/client/insurance/InsurancePlansManager.java 90.00% 0 Missing and 1 partial :warning:
Files with missing lines Coverage Δ Complexity Δ
.../model/client/insurance/InsurancePlansManager.java 86.02% <90.00%> (+0.20%) 44.00 <3.00> (+2.00)
RezwanAhmed123 commented 1 week ago

merged as all nits were fixed