ARK-Builders / ARK-Navigator

Android app for navigation through your data
MIT License
15 stars 15 forks source link

Refactor FileUtils & cover unit test #388

Closed hieuwu closed 8 months ago

hieuwu commented 9 months ago

Analysis

Currently, the FileUtils hold many responsibilities that lead to inconvinience when cover Unit test. This file contains lots of extension functions related to Path class and call App.instance to get list of device paths. This is not really a good design when refer to a singleton object inside method body, we can not mock the dependency when write test

Solution

Separate FileUtils unto 2 parts. 1 is used to extract the list devices and 1 for extension of Path class

Result

DevicePathsExtractorImpl

Screenshot 2023-10-08 at 22 51 17

PathExt

Screenshot 2023-10-08 at 22 50 41