VMM-MMV / MockInt

1 stars 0 forks source link

Instead of printing the answers create separate methods to return the results. #4

Open DrVasile opened 4 months ago

DrVasile commented 4 months ago

In the calculateStatistics you are printing the results to the questions. It would be better and easier to do unit testing if you would:

  1. Have 3 separate methods, or more, that would return the answers as return values.
  2. Remove the getters that you have in the StatisticsCalculator. The maps and other variables are used internally to obtain the answers so it is better to leave them as private and only return the answers to the tasks, which can also be used in the unit tests.
  3. The separate methods used to answers the questions might be re-used. For example you can re-use a methods that splits the input and processes it in order to get answers for the tasks 2 and 3.