Last active
September 8, 2021 15:29
-
-
Save PreyeaRegmi/d413d5068e6d6d5c74df21c332db1354 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MockedSucessRateFetchRepository extends ILoanRepository { | |
final LoanDetailDTO _mockedResponse; | |
MockedSucessRateFetchRepository(this._mockedResponse); | |
Future<LoanDetailDTO> getLoanFromServer(double amount, double time) { | |
return Future.value(this._mockedResponse); | |
} | |
} | |
class MockedFailedRateFetchRepository extends ILoanRepository { | |
final RateFethFailType _failType; | |
MockedFailedRateFetchRepository(this._failType); | |
Future<LoanDetailDTO> getLoanFromServer(double amount, double time) { | |
return Future.error(RateFetchFailException(_failType)); | |
} | |
} | |
class RateFetchFailException implements Exception | |
{ | |
final RateFetchFailType _failType; | |
RateFetchFailException(this._failType); | |
} | |
enum RateFetchFailType | |
{ | |
NETWORK | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment