Skip to content

Commit 464bd3f

Browse files
authored
Merge pull request #18 from moosetechnology/1282
correct FamixJavaClass>>isCBTestCase
2 parents 873e314 + 701b027 commit 464bd3f

29 files changed

+328
-293
lines changed

Moose-Blueprint-Models-Tests/CBClassBlueprintForJavaModelTest.class.st

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,29 @@ CBClassBlueprintForJavaModelTest >> testDeadAccessor [
9595
((classBlueprint accessors collect: #entity) detect: #isSetter)
9696
isDeadMethod
9797
]
98+
99+
{ #category : 'tests' }
100+
CBClassBlueprintForJavaModelTest >> testIsCBTestCase [
101+
102+
| famixClass famixClass2 class1 testcase inh1 inh2 testAnnotation testAnnotationInstance famixMethod |
103+
famixClass := FamixJavaClass new.
104+
class1 := FamixJavaClass new.
105+
testcase := FamixJavaClass named: 'TestCase'.
106+
inh1 := FamixJavaInheritance new
107+
superclass: testcase;
108+
subclass: class1.
109+
inh2 := FamixJavaInheritance new
110+
superclass: class1;
111+
subclass: famixClass.
112+
famixClass2 := FamixJavaClass new.
113+
testAnnotation := FamixJavaAnnotationType new name: 'Test'.
114+
testAnnotationInstance := FamixJavaAnnotationInstance new
115+
annotationType: testAnnotation.
116+
famixMethod := FamixJavaMethod new name: 'someMethodAnnotated'.
117+
famixClass2 addMethod: famixMethod.
118+
famixMethod annotationInstances add: testAnnotationInstance.
119+
"JUnit3"
120+
self assert: famixClass isCBTestCase.
121+
"JUnit4 and fllowing"
122+
self assert: famixClass2 isCBTestCase.
123+
]
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,46 @@
11
Class {
2-
#name : #CBAbstractModel,
3-
#superclass : #Object,
2+
#name : 'CBAbstractModel',
3+
#superclass : 'Object',
44
#instVars : [
55
'entity',
66
'description'
77
],
8-
#category : #'Moose-Blueprint-Models'
8+
#category : 'Moose-Blueprint-Models',
9+
#package : 'Moose-Blueprint-Models'
910
}
1011

11-
{ #category : #'instance creation' }
12+
{ #category : 'instance creation' }
1213
CBAbstractModel class >> newFrom: anEntity [
1314
self subclassResponsibility
1415
]
1516

16-
{ #category : #accessing }
17+
{ #category : 'accessing' }
1718
CBAbstractModel >> description [
1819
^ description
1920
]
2021

21-
{ #category : #accessing }
22+
{ #category : 'accessing' }
2223
CBAbstractModel >> entity [
2324
^ entity
2425
]
2526

26-
{ #category : #accessing }
27+
{ #category : 'accessing' }
2728
CBAbstractModel >> entity: anEntity [
2829
entity := anEntity
2930
]
3031

31-
{ #category : #initialization }
32+
{ #category : 'initialization' }
3233
CBAbstractModel >> initializeDescription [
3334

3435
self subclassResponsibility
3536
]
3637

37-
{ #category : #testing }
38+
{ #category : 'testing' }
3839
CBAbstractModel >> isHighlightable [
3940
^ false
4041
]
4142

42-
{ #category : #accessing }
43+
{ #category : 'accessing' }
4344
CBAbstractModel >> name [
4445
^ entity name
4546
]

Moose-Blueprint-Models/CBAccessorsModel.class.st

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,50 @@
22
I represent a model for getters and setters
33
"
44
Class {
5-
#name : #CBAccessorsModel,
6-
#superclass : #CBHighlightableModel,
5+
#name : 'CBAccessorsModel',
6+
#superclass : 'CBHighlightableModel',
77
#instVars : [
88
'accessorInvocations',
99
'attributeAccess',
1010
'modelType',
1111
'occurrences',
1212
'attribute'
1313
],
14-
#category : #'Moose-Blueprint-Models'
14+
#category : 'Moose-Blueprint-Models',
15+
#package : 'Moose-Blueprint-Models'
1516
}
1617

17-
{ #category : #'instance creation' }
18+
{ #category : 'instance creation' }
1819
CBAccessorsModel class >> newFrom: aMethod [
1920
^ self new
2021
entity: aMethod;
2122
yourself
2223
]
2324

24-
{ #category : #accessing }
25+
{ #category : 'accessing' }
2526
CBAccessorsModel >> accessorInvocations [
2627
^ accessorInvocations
2728
]
2829

29-
{ #category : #accessing }
30+
{ #category : 'accessing' }
3031
CBAccessorsModel >> addIncoming: anInvocation [
3132
((accessorInvocations collect: #target) includes: anInvocation target) ifFalse: [
3233
accessorInvocations add: anInvocation ]
3334
]
3435

35-
{ #category : #accessing }
36+
{ #category : 'accessing' }
3637
CBAccessorsModel >> addOutgoing: anAttributeAccess [
3738

3839
((attributeAccess collect: #source) includes: anAttributeAccess source) ifFalse: [
3940
attributeAccess add: anAttributeAccess ]
4041
]
4142

42-
{ #category : #accessing }
43+
{ #category : 'accessing' }
4344
CBAccessorsModel >> attributeAccess [
4445
^ attributeAccess
4546
]
4647

47-
{ #category : #accessing }
48+
{ #category : 'accessing' }
4849
CBAccessorsModel >> color [
4950

5051
"attribute isDead attribute protectors are dead "
@@ -54,26 +55,26 @@ CBAccessorsModel >> color [
5455
ifFalse: [ MiClassBlueprintPalette new colorAt: self type ]
5556
]
5657

57-
{ #category : #initialization }
58+
{ #category : 'initialization' }
5859
CBAccessorsModel >> initialize [
5960

6061
super initialize.
6162
accessorInvocations := OrderedCollection new.
6263
attributeAccess := OrderedCollection new
6364
]
6465

65-
{ #category : #testing }
66+
{ #category : 'testing' }
6667
CBAccessorsModel >> isCBGetter [
6768
^ entity isCBGetter
6869
]
6970

70-
{ #category : #testing }
71+
{ #category : 'testing' }
7172
CBAccessorsModel >> isDead [
7273

73-
^ self entity incomingInvocations isEmpty
74+
^ self entity isDead
7475
]
7576

76-
{ #category : #testing }
77+
{ #category : 'testing' }
7778
CBAccessorsModel >> isDeadAccessor [
7879

7980

@@ -82,59 +83,59 @@ CBAccessorsModel >> isDeadAccessor [
8283
^ attribute isDead and: [ attribute accessors allSatisfy: #isDead ]
8384
]
8485

85-
{ #category : #testing }
86+
{ #category : 'testing' }
8687
CBAccessorsModel >> isLazyInitializer [
8788
^ self entity isLazyInitializer
8889
]
8990

90-
{ #category : #testing }
91+
{ #category : 'testing' }
9192
CBAccessorsModel >> isSetter [
9293

9394
^ entity isCBSetter
9495
]
9596

96-
{ #category : #accessing }
97+
{ #category : 'accessing' }
9798
CBAccessorsModel >> modelType [
9899
^ modelType
99100
]
100101

101-
{ #category : #accessing }
102+
{ #category : 'accessing' }
102103
CBAccessorsModel >> modelType: aSymbol [
103104
modelType := aSymbol
104105
]
105106

106-
{ #category : #accessing }
107+
{ #category : 'accessing' }
107108
CBAccessorsModel >> newIncomingConnection [
108109

109110
^ CBAccessorInvocationModel new
110111
initializeDescription;
111112
yourself
112113
]
113114

114-
{ #category : #accessing }
115+
{ #category : 'accessing' }
115116
CBAccessorsModel >> occurrences [
116117
^ occurrences
117118
]
118119

119-
{ #category : #accessing }
120+
{ #category : 'accessing' }
120121
CBAccessorsModel >> occurrences: aNumber [
121122
occurrences := aNumber
122123
]
123124

124-
{ #category : #printing }
125+
{ #category : 'printing' }
125126
CBAccessorsModel >> printOn: aStream [
126127

127128
aStream nextPutAll: '('.
128129
self name asString printOn: aStream.
129130
aStream nextPutAll: ')'
130131
]
131132

132-
{ #category : #accessing }
133+
{ #category : 'accessing' }
133134
CBAccessorsModel >> protecting: anAttribte [
134135
attribute := anAttribte
135136
]
136137

137-
{ #category : #accessing }
138+
{ #category : 'accessing' }
138139
CBAccessorsModel >> shape [
139140

140141
shape := RSBox new
@@ -148,7 +149,7 @@ CBAccessorsModel >> shape [
148149
^ shape
149150
]
150151

151-
{ #category : #accessing }
152+
{ #category : 'accessing' }
152153
CBAccessorsModel >> type [
153154

154155
(self entity isPureGetter or: [ self entity isSetter ]) ifTrue: [ ^#'isSetter or isGetter' ].

0 commit comments

Comments
 (0)