Cody Engel
08/03/2020, 6:48 PMval notAMock = NotAMock() // some sample class, it's not a mock
every { notAMock.getAString() } returns "This should not work, right?"
assertEquals("This should not work, right?", notAMock.getAString()) // passes
This is a simplified example of code I was reviewing for an internal project at work. In that case notAMock
was a class under test that should not be mocked, it was easy to overlook on the first pass but I saw the behavior repeated in a few tests which is how I caught it. I would expect some exception to be thrown if a real object is being mocked.