Skip to content

Instantly share code, notes, and snippets.

@oliverspryn
Created October 29, 2021 12:33
Show Gist options
  • Select an option

  • Save oliverspryn/431ae6620dbe366bf6baf67ab03270e3 to your computer and use it in GitHub Desktop.

Select an option

Save oliverspryn/431ae6620dbe366bf6baf67ab03270e3 to your computer and use it in GitHub Desktop.
A faulty unit test, where only one side-effect is tested, giving me credit for full function coverage
class DetailsViewMvcImplTest : Spek({
describe("The DetailsViewMvcImpl") {
var mockButton: MaterialButton? = null
var mockPhoto: AppCompatImageView? = null
var mockRootView: View? = null
var mockTitle: AppCompatTextView? = null
var uut: DetailsViewMvcImpl? = null
beforeEachTest {
// Setup the mocks and UUT here
}
describe("when init") {
it("inflates the layout and sets it as the root view") {
expect(uut?.rootView).to.equal(mockRootView)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment