-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMolEventNotifierTest.class.st
More file actions
120 lines (97 loc) · 2.95 KB
/
MolEventNotifierTest.class.st
File metadata and controls
120 lines (97 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
"
A MolEventNotifierTest is a test class for testing the behavior of MolEventNotifier
"
Class {
#name : #MolEventNotifierTest,
#superclass : #TestCase,
#category : #'Molecule-Tests-Cases'
}
{ #category : #running }
MolEventNotifierTest >> setUp [
super setUp.
MolComponentManager cleanUp
]
{ #category : #running }
MolEventNotifierTest >> tearDown [
MolComponentManager cleanUp.
super tearDown
]
{ #category : #tests }
MolEventNotifierTest >> testActivate [
| notifier |
notifier := MolEventNotifier new.
notifier activate.
self assert: notifier isActive.
]
{ #category : #tests }
MolEventNotifierTest >> testDeactivate [
| notifier |
notifier := MolEventNotifier new.
notifier activate.
notifier deactivate.
self assert: notifier isActive not.
]
{ #category : #tests }
MolEventNotifierTest >> testDoesNotUnderstand [
| originator notifier error |
originator := MolCompleteComponentImpl new.
notifier := MolEventNotifier interface: MolUsedEvents originator: originator.
notifier event.
"MolUsedEvent>>subEvent not exists"
error := nil.
[notifier subEvent] on: Error do:[ :e | error := e ].
self assert: (error isKindOf: MessageNotUnderstood).
]
{ #category : #tests }
MolEventNotifierTest >> testDoesNotUnderstandWithoutCorrectDefinition [
| notifier error |
notifier := MolEventNotifier new.
error := nil.
[notifier event] on: Error do:[ :e | error := e ].
self assert: (error isKindOf: MessageNotUnderstood).
notifier interface: MolUsedEvents.
notifier event. "Make a log but not raised an error"
]
{ #category : #tests }
MolEventNotifierTest >> testInitialize [
| notifier |
notifier := MolEventNotifier new.
self assert: notifier interface isNil.
self assert: notifier originator isNil.
self deny: notifier isActive
]
{ #category : #tests }
MolEventNotifierTest >> testInterfaceOriginator [
| notifier originator |
originator := MolCompleteComponentImpl new.
notifier := MolEventNotifier
interface: MolUsedEvents
originator: originator.
self assert: notifier interface identicalTo: MolUsedEvents.
self assert: notifier originator identicalTo: originator.
self deny: notifier isActive
]
{ #category : #tests }
MolEventNotifierTest >> testIsNotFoundEventsNotifier [
| notifier |
notifier := MolEventNotifier new.
self assert: notifier isNotFoundEventsNotifier not.
]
{ #category : #tests }
MolEventNotifierTest >> testRelease [
| notifier originator error |
originator := MolCompleteComponentImpl new.
notifier := MolEventNotifier
interface: MolUsedEvents
originator: originator.
notifier activate.
notifier release.
self assert: notifier originator isNil.
self deny: notifier isActive.
"try to send an event when release: do nothing"
notifier event.
"MolUsedEvent>>subEvent not exists: continue to raise not understood message to identify call problems"
error := nil.
[notifier subEvent] on: Error do:[ :e | error := e ].
self assert: (error isKindOf: MessageNotUnderstood).
]