Things to notice in the project:
-
The UI tests in the AccountFragmentTest don't work due to mocking problems:
(E/TestRunner: java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)) -
The tests of the
Repositoryclass could be better tested. -
The extension function or mapper from
AcountDatatoAccounttakes a bit more than50ms. I couldn't come up with a better solution, so I decided to go for this one. The way this mapping function works is:- From the transactions in an
AccountDataI map them to aTransactionwith abeforeBalanceandafterBalanceof 0. - Then, those transactions inside the list, they are sorted by date (the date in the
Transactionmodel is aLocalDateTimeand it can easily compared and thus sorted). - And finally, I created a new extension function from a
List<Transaction>calledmap, which given aTransactionfrom the list, an initial balance, and iterates through every transaction in the list, accumulating the initial balance in theaccumulatorproperty, thebalanceBeforeis assigned the value of theaccumulatorand thebalanceAfteras the sum of theaccumulatorplus the amount of the transaction. Finally, once thebalanceBeforeandbalanceAfterare initialized with the proper values, the current transaction is copied with the newbalanceBeforeandbalanceAftervalues.
- From the transactions in an

