-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rule for mockserver #48
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice additions, just a couple questions
class MockServerTestRule<T : Activity>( | ||
activityClass: Class<T>?, | ||
initialTouchMode: Boolean, | ||
launchActivity: Boolean) : ActivityTestRule<T>(activityClass, initialTouchMode, launchActivity) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
App.Companion.component = appComponent | ||
mockWebServer.play(port) | ||
} | ||
var activityRule: MockServerTestRule<MainActivity> = activityTestRule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the MockServer and MainActivity know about each other?
An alternative could be to keep separate rules and chain them as needed, to keep them more flexible too
|
||
@get:Rule | ||
var activityRule: MockServerTestRule<MainActivity> = activityTestRule | ||
var chain: TestRule = RuleChain.outerRule(activityTestRule) | ||
.around(mockServerTestRule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
This PR adds a Rule for using the Mockwebserver.
This makes it easier and less verbose to add mock server requests