Skip to content
Prev Previous commit
Next Next commit
making test classes final and private
  • Loading branch information
chrisdlangham committed Aug 29, 2023
commit 761c6d9dac0324a11fa547b47681c2658f807020
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import XCTest

@testable import url_launcher_ios

class URLLauncherTests: XCTestCase {
var plugin: FLTURLLauncherPlugin!
var launcher: FakeLauncher!
final class URLLauncherTests: XCTestCase {
private var plugin: FLTURLLauncherPlugin!
private var launcher: FakeLauncher!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did the test class become stateful in this migration? Stateful test fixtures are generally an anti-pattern, and making the object under test stateful is especially problematic.


override func setUp() {
launcher = FakeLauncher()
Expand Down Expand Up @@ -108,7 +108,7 @@ class URLLauncherTests: XCTestCase {

}

class FakeLauncher: NSObject, FULLauncher {
final fileprivate class FakeLauncher: NSObject, FULLauncher {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need this to inherit from NSObject?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes since the plugin is still in objective-c

var passedOptions: [UIApplication.OpenExternalURLOptionsKey: Any]?

func canOpen(_ url: URL) -> Bool {
Expand All @@ -124,7 +124,7 @@ class FakeLauncher: NSObject, FULLauncher {
}
}

class FakeFlutterBinaryMessenger: NSObject, FlutterBinaryMessenger {
final fileprivate class FakeFlutterBinaryMessenger: NSObject, FlutterBinaryMessenger {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, why does this class even exist? It's not used anywhere, and it wasn't in the Obj-C version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

func send(onChannel channel: String, message: Data?) {}

func send(
Expand Down