mardi 23 juillet 2019

How can I test a void static method in Dart/Flutter?

I'm trying to unit test a class that has static void methods.

I'm using Mockito (verify) to check if a void method call another function as expected, but it doesn't work to static methods.

class SystemUtils {
  // ...

  static void handleError(bool isDebug, FlutterErrorDetails details) {
    if (isDebug) {
      FlutterError.dumpErrorToConsole(details);
    } else {
      Crashlytics.instance.onError(details);
    }
  }
}

Aucun commentaire:

Enregistrer un commentaire