refactoring_custom/SmallSense__CustomMockTests.st
author convert-repo
Wed, 11 Dec 2019 04:28:36 +0000
changeset 1116 b51ace366efc
parent 1072 a44c741ee5ef
permissions -rw-r--r--
update tags
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
829
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
     1
"
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
     2
A custom code generation and refactoring support for Smalltalk/X
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
     3
Copyright (C) 2013-2015 Jakub Nesveda
1072
a44c741ee5ef Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
     4
Copyright (C) 2015 Jan Vrany
829
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
     5
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
     6
This library is free software; you can redistribute it and/or
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
     7
modify it under the terms of the GNU Lesser General Public
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
     8
License as published by the Free Software Foundation; either
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
     9
version 2.1 of the License.
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    10
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    11
This library is distributed in the hope that it will be useful,
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    12
but WITHOUT ANY WARRANTY; without even the implied warranty of
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    14
Lesser General Public License for more details.
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    15
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    16
You should have received a copy of the GNU Lesser General Public
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    17
License along with this library; if not, write to the Free Software
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    19
"
833
297eb38e4eee Package jn:refactoring_custom renamed to stx:goodies/smallsense/refactoring_custom
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 830
diff changeset
    20
"{ Package: 'stx:goodies/smallsense/refactoring_custom' }"
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    21
830
1a88f5e65fe2 Classes moved to namespace SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 829
diff changeset
    22
"{ NameSpace: SmallSense }"
803
95cdac772759 Fixed failing tests caused by new STX release
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 799
diff changeset
    23
830
1a88f5e65fe2 Classes moved to namespace SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 829
diff changeset
    24
Smalltalk::TestCase subclass:#CustomMockTests
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
    25
	instanceVariableNames:'model mock testCompleted'
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    26
	classVariableNames:''
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    27
	poolDictionaries:''
626
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 604
diff changeset
    28
	category:'Interface-Refactoring-Custom-Tests'
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    29
!
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    30
829
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    31
!CustomMockTests class methodsFor:'documentation'!
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    32
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    33
copyright
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    34
"
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    35
A custom code generation and refactoring support for Smalltalk/X
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    36
Copyright (C) 2013-2015 Jakub Nesveda
1072
a44c741ee5ef Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    37
Copyright (C) 2015 Jan Vrany
829
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    38
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    39
This library is free software; you can redistribute it and/or
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    40
modify it under the terms of the GNU Lesser General Public
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    41
License as published by the Free Software Foundation; either
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    42
version 2.1 of the License.
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    43
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    44
This library is distributed in the hope that it will be useful,
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    45
but WITHOUT ANY WARRANTY; without even the implied warranty of
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    46
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    47
Lesser General Public License for more details.
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    48
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    49
You should have received a copy of the GNU Lesser General Public
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    50
License along with this library; if not, write to the Free Software
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    51
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    52
"
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 816
diff changeset
    53
! !
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    54
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    55
!CustomMockTests methodsFor:'initialization & release'!
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    56
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    57
setUp
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    58
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
    59
    model := CustomNamespace new.
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    60
    mock := CustomMock new.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    61
    testCompleted := false.
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    62
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
    63
    "Modified: / 09-10-2014 / 09:34:02 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    64
!
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    65
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    66
tearDown
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    67
705
1eb0878dc85c rename undoChanges to redoChanges, because it actually does undo, in CustomLocalChangeManager, CustomNamespace, CustomRefactoryBuilder
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    68
    model undoChanges.
604
cbc948d8ee4e forget to uncomment cleanup in tearDown method
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 602
diff changeset
    69
    mock unmockAll
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    70
705
1eb0878dc85c rename undoChanges to redoChanges, because it actually does undo, in CustomLocalChangeManager, CustomNamespace, CustomRefactoryBuilder
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    71
    "Modified: / 19-10-2014 / 14:56:34 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    72
! !
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    73
678
9cbc864fa235 CustomMock - do not mess changes file with test class modifications
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 676
diff changeset
    74
!CustomMockTests methodsFor:'private'!
9cbc864fa235 CustomMock - do not mess changes file with test class modifications
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 676
diff changeset
    75
9cbc864fa235 CustomMock - do not mess changes file with test class modifications
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 676
diff changeset
    76
performTest
9cbc864fa235 CustomMock - do not mess changes file with test class modifications
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 676
diff changeset
    77
    Class withoutUpdatingChangesDo:[
9cbc864fa235 CustomMock - do not mess changes file with test class modifications
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 676
diff changeset
    78
        self perform: testSelector sunitAsSymbol
9cbc864fa235 CustomMock - do not mess changes file with test class modifications
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 676
diff changeset
    79
    ]
9cbc864fa235 CustomMock - do not mess changes file with test class modifications
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 676
diff changeset
    80
9cbc864fa235 CustomMock - do not mess changes file with test class modifications
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 676
diff changeset
    81
    "Created: / 24-09-2014 / 21:30:51 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
9cbc864fa235 CustomMock - do not mess changes file with test class modifications
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 676
diff changeset
    82
! !
9cbc864fa235 CustomMock - do not mess changes file with test class modifications
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 676
diff changeset
    83
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    84
!CustomMockTests methodsFor:'tests'!
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    85
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    86
test_class_and_instance_methods_overriden_by_compiled_mock_method
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    87
    | class mockClass |
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    88
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    89
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
    90
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
    91
        model createMethodImmediate: (class theMetaclass) protocol: 'p' source: 'aSelector_01: aParam
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    92
        ^ 10'.
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
    93
        model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: aParam
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    94
        ^ 15'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    95
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    96
        self assert: (class aSelector_01: nil) = 10.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    97
        self assert: (class new aSelector_01: nil) = 15.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    98
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
    99
        mockClass := mock mockClassOf: class.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   100
        mockClass compileMockMethod: 'aSelector_01: aParam ^ 20'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   101
        mockClass new compileMockMethod: 'aSelector_01: aParam ^ 25'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   102
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   103
        self assert: (mockClass aSelector_01: nil) = 20.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   104
        self assert: (mockClass new aSelector_01: nil) = 25.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   105
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   106
        testCompleted := true.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   107
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   108
    ] ensure: [
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   109
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   110
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   111
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   112
    ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   113
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   114
    "Created: / 23-09-2014 / 22:53:52 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   115
!
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   116
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   117
test_class_methods_overriden_by_compiled_mock_method
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   118
    | class mockClass |
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   119
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   120
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   121
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   122
        model createMethodImmediate: (class theMetaclass) protocol: 'p' source: 'aSelector_01: aParam
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   123
        ^ 10'.
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   124
        model createMethodImmediate: (class theMetaclass) protocol: 'p' source: 'aSelector_02: aParam
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   125
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   126
        (self aSelector_01: aParam) = 10 ifTrue: [ ^ true ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   127
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   128
        ^ false'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   129
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   130
        self assert: (class aSelector_02: nil).
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   131
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   132
        mockClass := mock mockClassOf: class.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   133
        mockClass compileMockMethod: 'aSelector_01: aParam ^ 20'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   134
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   135
        self assert: (mockClass aSelector_01: nil) = 20.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   136
        self assert: (mockClass aSelector_02: nil) not.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   137
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   138
        testCompleted := true.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   139
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   140
    ] ensure: [
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   141
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   142
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   143
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   144
    ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   145
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   146
    "Created: / 23-09-2014 / 22:54:13 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
602
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   147
!
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   148
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   149
test_class_methods_overriden_by_mock
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   150
    | class mockClass |
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   151
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   152
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   153
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   154
        model createMethodImmediate: class theMetaclass protocol: 'p' source: 'aSelector_01: aParam
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   155
        ^ 10'.
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   156
        model createMethodImmediate: class theMetaclass protocol: 'p' source: 'aSelector_02: aParam
602
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   157
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   158
        (self aSelector_01: aParam) = 10 ifTrue: [ ^ true ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   159
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   160
        ^ false'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   161
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   162
        self assert: (class aSelector_02: nil).
602
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   163
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   164
        mockClass := mock mockClassOf: class.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   165
        mockClass mockSelector: #aSelector_01: withReturnValue: 20.
602
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   166
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   167
        self assert: (mockClass aSelector_01: nil) = 20.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   168
        self assert: (mockClass aSelector_02: nil) not. 
602
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   169
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   170
        testCompleted := true.
602
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   171
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   172
    ] ensure: [
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   173
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   174
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   175
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   176
    ].
602
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   177
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   178
    "Created: / 10-07-2014 / 19:35:52 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   179
    "Modified (format): / 22-09-2014 / 23:14:13 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
602
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   180
!
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   181
787
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   182
test_create_mock_getters_for_selectors    
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   183
    | expectedSource01 actualSource01 expectedSource02 actualSource02 mockClass |
786
1026bdbe1f21 Added method for creating mocked getter/setter methods in CustomMock >> createMockAccessors:forNames:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 705
diff changeset
   184
787
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   185
    mockClass := mock mockClassOf: Object.
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   186
    mock createMockGetters: mockClass forSelectors: {'selector'. 'selector:'}.
786
1026bdbe1f21 Added method for creating mocked getter/setter methods in CustomMock >> createMockAccessors:forNames:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 705
diff changeset
   187
787
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   188
    expectedSource01 := 'selector ^ self objectAttributeAt: #selector'.
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   189
    expectedSource02 := 'selector:arg ^ self objectAttributeAt: #selector:'.
786
1026bdbe1f21 Added method for creating mocked getter/setter methods in CustomMock >> createMockAccessors:forNames:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 705
diff changeset
   190
787
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   191
    actualSource01 := mockClass sourceCodeAt:#selector.
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   192
    actualSource02 := mockClass sourceCodeAt:#selector:.
786
1026bdbe1f21 Added method for creating mocked getter/setter methods in CustomMock >> createMockAccessors:forNames:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 705
diff changeset
   193
787
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   194
    self assert: expectedSource01 = actualSource01.           
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   195
    self assert: expectedSource02 = actualSource02.
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   196
6e304a46a550 Better create just mocked getters instead of accessors in CustomMock >> createMockGetters:forSelectors:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 786
diff changeset
   197
    "Modified: / 28-12-2014 / 15:29:13 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
786
1026bdbe1f21 Added method for creating mocked getter/setter methods in CustomMock >> createMockAccessors:forNames:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 705
diff changeset
   198
!
1026bdbe1f21 Added method for creating mocked getter/setter methods in CustomMock >> createMockAccessors:forNames:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 705
diff changeset
   199
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   200
test_methods_overriden_by_compiled_mock_method
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   201
    | class mockClassInstance |
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   202
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   203
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   204
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   205
        model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: aParam
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   206
        ^ 10'.
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   207
        model createMethodImmediate: class protocol: 'p' source: 'aSelector_02: aParam
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   208
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   209
        (self aSelector_01: aParam) = 10 ifTrue: [ ^ true ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   210
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   211
        ^ false'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   212
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   213
        self assert: (class new aSelector_02: nil).
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   214
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   215
        mockClassInstance := mock mockOf: class.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   216
        mockClassInstance compileMockMethod: 'aSelector_01: aParam ^ 20'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   217
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   218
        self assert: (mockClassInstance aSelector_01: nil) = 20.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   219
        self assert: (mockClassInstance aSelector_02: nil) not.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   220
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   221
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   222
        testCompleted := true.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   223
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   224
    ] ensure: [ 
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   225
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   226
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   227
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   228
    ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   229
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   230
    "Created: / 23-09-2014 / 22:54:23 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   231
!
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   232
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   233
test_methods_overriden_by_compiled_mock_method_value_with_params
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   234
    | class mockClassInstance |
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   235
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   236
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   237
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   238
        model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: aParam
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   239
        ^ 10'.
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   240
        model createMethodImmediate: class protocol: 'p' source: 'aSelector_02: aParam
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   241
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   242
        (self aSelector_01: aParam) = 10 ifTrue: [ ^ true ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   243
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   244
        ^ false'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   245
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   246
        self assert: (class new aSelector_02: nil).
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   247
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   248
        mockClassInstance := mock mockOf: class.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   249
        mockClassInstance compileMockMethod: 'aSelector_01: aParam
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   250
            aParam = 5 ifTrue: [
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   251
                ^ 10
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   252
            ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   253
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   254
            ^ 30'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   255
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   256
        self assert: (mockClassInstance aSelector_01: 5) = 10.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   257
        self assert: (mockClassInstance aSelector_02: 3) not.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   258
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   259
        testCompleted := true.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   260
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   261
    ] ensure: [ 
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   262
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   263
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   264
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   265
    ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   266
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   267
    "Created: / 23-09-2014 / 22:54:42 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   268
!
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   269
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   270
test_methods_overriden_by_compiled_mock_method_value_with_two_params
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   271
    | class mockClassInstance |
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   272
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   273
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   274
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   275
        model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: arg_01 param_02: arg_02
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   276
        ^ 10'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   277
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   278
        self assert: ((class new aSelector_01: 1 param_02: 2) = 10).
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   279
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   280
        mockClassInstance := mock mockOf: class.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   281
        mockClassInstance compileMockMethod: 'aSelector_01:arg_01 param_02:arg_02 ^ arg_01 + arg_02'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   282
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   283
        self assert: (mockClassInstance aSelector_01: 3 param_02: 3) = 6.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   284
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   285
        testCompleted := true.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   286
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   287
    ] ensure: [ 
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   288
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   289
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   290
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   291
    ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   292
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   293
    "Created: / 23-09-2014 / 22:54:49 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   294
!
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   295
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   296
test_methods_overriden_by_compiled_mock_method_with_none_params
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   297
    | class mockClassInstance |
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   298
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   299
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   300
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   301
        model createMethodImmediate: class protocol: 'p' source: 'aSelector_01
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   302
        ^ 10'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   303
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   304
        self assert: (class new aSelector_01 = 10).
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   305
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   306
        mockClassInstance := mock mockOf: class.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   307
        mockClassInstance compileMockMethod: 'aSelector_01 ^ 30'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   308
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   309
        self assert: (mockClassInstance aSelector_01) = 30.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   310
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   311
        testCompleted := true.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   312
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   313
    ] ensure: [
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   314
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   315
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   316
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   317
    ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   318
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   319
    "Created: / 23-09-2014 / 22:54:34 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   320
!
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   321
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   322
test_methods_overriden_by_compiled_mock_method_with_three_params
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   323
    | class mockClassInstance |
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   324
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   325
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   326
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   327
        model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: arg_01 param_02: arg_02 param_03: arg_03
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   328
        ^ 10'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   329
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   330
        self assert: ((class new aSelector_01: 1 param_02: 2 param_03: 3) = 10).
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   331
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   332
        mockClassInstance := mock mockOf: class.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   333
        mockClassInstance compileMockMethod: 'aSelector_01:arg_01 param_02:arg_02 param_03:arg_03  
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   334
            ^ arg_01 + arg_02 + arg_03'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   335
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   336
        self assert: (mockClassInstance aSelector_01: 3 param_02: 3 param_03: 3) = 9.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   337
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   338
        testCompleted := true.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   339
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   340
    ] ensure: [ 
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   341
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   342
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   343
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   344
    ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   345
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   346
    "Created: / 23-09-2014 / 22:55:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
602
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   347
!
d7e602c78a28 CustomMock - add method mocking for both class and instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 576
diff changeset
   348
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   349
test_methods_overriden_by_mock
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   350
    | class mockClassInstance |
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   351
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   352
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   353
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   354
        model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: aParam
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   355
        ^ 10'.
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   356
        model createMethodImmediate: class protocol: 'p' source: 'aSelector_02: aParam
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   357
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   358
        (self aSelector_01: aParam) = 10 ifTrue: [ ^ true ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   359
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   360
        ^ false'.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   361
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   362
        self assert: (class new aSelector_02: nil).
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   363
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   364
        mockClassInstance := mock mockOf: class.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   365
        mockClassInstance mockSelector: #aSelector_01: withReturnValue: 20.
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   366
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   367
        self assert: (mockClassInstance aSelector_01: nil) = 20.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   368
        self assert: (mockClassInstance aSelector_02: nil) not.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   369
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   370
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   371
        testCompleted := true.
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   372
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   373
    ] ensure: [ 
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   374
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   375
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   376
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   377
    ].
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   378
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   379
    "Created: / 15-06-2014 / 20:19:47 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   380
    "Modified (format): / 22-09-2014 / 23:14:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
576
b8e70d6ade95 CustomMock - add possibility for mocking messages with arguments
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 574
diff changeset
   381
!
b8e70d6ade95 CustomMock - add possibility for mocking messages with arguments
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 574
diff changeset
   382
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   383
test_mock_count_incremented_when_new_class_created
804
14025d247548 Improved code quality/readibility with help of Smalllint
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 803
diff changeset
   384
    | class mockCount |
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   385
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   386
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   387
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   388
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   389
        mockCount := mock mockCount.  
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   390
804
14025d247548 Improved code quality/readibility with help of Smalllint
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 803
diff changeset
   391
        mock mockOf: class.
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   392
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   393
        self assert: (mockCount + 1) = (mock mockCount).
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   394
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   395
        testCompleted := true.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   396
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   397
    ] ensure: [ 
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   398
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   399
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   400
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   401
    ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   402
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   403
    "Created: / 22-09-2014 / 23:05:31 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
804
14025d247548 Improved code quality/readibility with help of Smalllint
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 803
diff changeset
   404
    "Modified: / 25-01-2015 / 15:19:00 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   405
!
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   406
799
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   407
test_namespace_not_created_for_class_with_namespace
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   408
    "If class name contains also namespace name then it is created along with the class.
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   409
    Assert that namespace is not created, because there is no use for it in temporary class
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   410
    - only leaves mess in the browser."
804
14025d247548 Improved code quality/readibility with help of Smalllint
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 803
diff changeset
   411
    | class expectedNameSpaceCount actualNameSpaceCount |
799
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   412
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   413
    [
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   414
        class := model createClassImmediate: 'DummyNameSpace01::DummyClass01'.
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   415
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   416
        expectedNameSpaceCount := NameSpace allNameSpaces size.
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   417
        self assert: expectedNameSpaceCount > 1.
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   418
804
14025d247548 Improved code quality/readibility with help of Smalllint
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 803
diff changeset
   419
        mock mockClassOf: class.
799
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   420
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   421
        actualNameSpaceCount := NameSpace allNameSpaces size.
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   422
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   423
        self assert: expectedNameSpaceCount = actualNameSpaceCount.
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   424
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   425
        testCompleted := true.
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   426
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   427
    ] ensure: [
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   428
        (Smalltalk at: #DummyNameSpace01) notNil ifTrue: [ 
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   429
            Class withoutUpdatingChangesDo: [  
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   430
                (Smalltalk at: #DummyNameSpace01) removeFromSystem
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   431
            ]
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   432
        ].
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   433
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   434
        "Need to test if test is complete, because in this case
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   435
        sometimes happens that the test terminates and is marked as success."
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   436
        self assert: testCompleted
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   437
    ].
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   438
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   439
    "Created: / 24-01-2015 / 19:22:50 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
804
14025d247548 Improved code quality/readibility with help of Smalllint
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 803
diff changeset
   440
    "Modified: / 25-01-2015 / 15:19:20 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
799
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   441
!
b3979623337e Fixed unwanted creation of namespaces which leades to mess in the browser in CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 787
diff changeset
   442
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   443
test_unmock_all
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   444
    | class mockClass mockClassName |
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   445
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   446
    [
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 678
diff changeset
   447
        class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   448
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   449
        mockClass := mock mockClassOf: class.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   450
        mockClassName := mockClass name.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   451
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   452
        self assert: (Smalltalk at: mockClassName) isNil not.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   453
        mock unmockAll.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   454
        self assert: (Smalltalk at: mockClassName) isNil.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   455
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   456
        testCompleted := true.
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   457
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   458
    ] ensure: [
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   459
        "Need to test if test is complete, because in this case
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   460
        sometimes happens that the test terminates and is marked as success."
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   461
        self assert: testCompleted
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   462
    ].
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   463
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   464
    "Created: / 23-09-2014 / 22:58:29 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
574
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   465
! !
2cb6846853bc add poor mans mocking class CustomMock
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   466
676
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   467
!CustomMockTests class methodsFor:'documentation'!
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   468
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   469
version_HG
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   470
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   471
    ^ '$Changeset: <not expanded> $'
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   472
! !
669ed47b353e add method compileMockMethod: aSourceCode to CustomMock as replacement for mockSelector: aSelector withBlockValue: aBlock which does not work and causes allways test pass
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   473