Skip to content

Instantly share code, notes, and snippets.

@PreyeaRegmi
Last active September 8, 2021 15:29
Show Gist options
  • Save PreyeaRegmi/d413d5068e6d6d5c74df21c332db1354 to your computer and use it in GitHub Desktop.
Save PreyeaRegmi/d413d5068e6d6d5c74df21c332db1354 to your computer and use it in GitHub Desktop.
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