keeganwitt / gmock

Automatically exported from code.google.com/p/gmock
6 stars 2 forks source link

Should not allow assigning properties in record state #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following test should pass:

    void testAssignPropertyInRecordState() {
        def mockLoader = mock()
        shouldFail(MissingPropertyException) {
            mockLoader.id = 1 
        }
    }

Original issue reported on code.google.com by JohnnyJianHY on 25 Nov 2008 at 2:21

GoogleCodeExporter commented 9 years ago

Original comment by julien.g...@gmail.com on 25 Nov 2008 at 7:32

GoogleCodeExporter commented 9 years ago
Do you think a message "Please use 'mockObject.id.sets(1)' to mock a setter" is 
good 
enough?

Original comment by JohnnyJianHY on 25 Nov 2008 at 8:33

GoogleCodeExporter commented 9 years ago
Yes that sound good to me. We can had a friendly message:
Cannot use property set in record mode. Are you trying to mock a setter? use
id.set(1) instead. 

Original comment by julien.g...@gmail.com on 25 Nov 2008 at 8:42

GoogleCodeExporter commented 9 years ago

Original comment by JohnnyJianHY on 25 Nov 2008 at 9:32