@@ -44,6 +44,74 @@ FamixJavaMethodTest >> testAllOverridingMethods [
44
44
otherOverridingMethod }
45
45
]
46
46
47
+ { #category : #tests }
48
+ FamixJavaMethodTest >> testAllOverridingMethodsInInterface [
49
+
50
+ | signature overridingMethod otherOverridingMethod i subclass subSubclass |
51
+ signature := ' javaMethod()' .
52
+ method signature: signature.
53
+ overridingMethod := FamixJavaMethod new signature: signature.
54
+ otherOverridingMethod := FamixJavaMethod new signature: signature.
55
+
56
+ i := FamixJavaInterface new .
57
+ subclass := FamixJavaClass new .
58
+ subSubclass := FamixJavaClass new .
59
+
60
+ i addMethod: method.
61
+ subclass addMethod: overridingMethod.
62
+ subSubclass addMethod: otherOverridingMethod.
63
+
64
+ FamixJavaImplementation new
65
+ interface: i;
66
+ implementingClass: subclass.
67
+ FamixJavaInheritance new
68
+ superclass: subclass;
69
+ subclass: subSubclass.
70
+
71
+ self assertCollection: method overridingMethods hasSameElements: {
72
+ overridingMethod.
73
+ otherOverridingMethod }
74
+ ]
75
+
76
+ { #category : #tests }
77
+ FamixJavaMethodTest >> testAllOverridingMethodsInInterfaceWithExtendingInterface [
78
+
79
+ | signature overridingMethod otherOverridingMethod i subclass subSubclass i2 |
80
+ signature := ' javaMethod()' .
81
+ method signature: signature.
82
+ overridingMethod := FamixJavaMethod new signature: signature.
83
+ otherOverridingMethod := FamixJavaMethod new signature: signature.
84
+
85
+ i := FamixJavaInterface new
86
+ name: ' i' ;
87
+ yourself .
88
+ i2 := FamixJavaInterface new
89
+ name: ' i2' ;
90
+ yourself .
91
+
92
+ subclass := FamixJavaClass new .
93
+ subSubclass := FamixJavaClass new .
94
+
95
+ i addMethod: method.
96
+ subclass addMethod: overridingMethod.
97
+ subSubclass addMethod: otherOverridingMethod.
98
+
99
+ FamixJavaInheritance new
100
+ superclass: i;
101
+ subclass: i2.
102
+ FamixJavaImplementation new
103
+ interface: i2;
104
+ implementingClass: subclass.
105
+
106
+ FamixJavaInheritance new
107
+ superclass: subclass;
108
+ subclass: subSubclass.
109
+
110
+ self assertCollection: method overridingMethods hasSameElements: {
111
+ overridingMethod.
112
+ otherOverridingMethod }
113
+ ]
114
+
47
115
{ #category : #tests }
48
116
FamixJavaMethodTest >> testDefaultIsStub [
49
117
self deny: method isStub
@@ -272,6 +340,58 @@ FamixJavaMethodTest >> testOverridingMethods [
272
340
hasSameElements: { overridingMethod }
273
341
]
274
342
343
+ { #category : #tests }
344
+ FamixJavaMethodTest >> testOverridingMethodsInInterface [
345
+
346
+ | signature overridingMethod i c |
347
+ signature := ' javaMethod()' .
348
+ method signature: signature.
349
+ overridingMethod := FamixJavaMethod new signature: signature.
350
+
351
+ i := FamixJavaInterface new .
352
+ c := FamixJavaClass new .
353
+
354
+ i addMethod: method.
355
+ c addMethod: overridingMethod.
356
+
357
+ FamixJavaImplementation new
358
+ interface: i;
359
+ implementingClass: c.
360
+
361
+ self
362
+ assertCollection: method overridingMethods
363
+ hasSameElements: { overridingMethod }
364
+ ]
365
+
366
+ { #category : #tests }
367
+ FamixJavaMethodTest >> testOverridingMethodsInterfaceExtendsInterface [
368
+
369
+ | signature overridingMethod i i2 overridingMethod2 i3 |
370
+ signature := ' javaMethod()' .
371
+ method signature: signature.
372
+ overridingMethod := FamixJavaMethod new signature: signature.
373
+ overridingMethod2 := FamixJavaMethod new signature: signature.
374
+
375
+ i := FamixJavaInterface new .
376
+ i2 := FamixJavaInterface new .
377
+ i3 := FamixJavaInterface new .
378
+ i addMethod: method.
379
+ i2 addMethod: overridingMethod.
380
+ i3 addMethod: overridingMethod2.
381
+
382
+ FamixJavaInheritance new
383
+ superclass: i;
384
+ subclass: i2.
385
+
386
+ FamixJavaInheritance new
387
+ superclass: i2;
388
+ subclass: i3.
389
+
390
+ self assertCollection: method overridingMethods hasSameElements: {
391
+ overridingMethod.
392
+ overridingMethod2 }
393
+ ]
394
+
275
395
{ #category : #tests }
276
396
FamixJavaMethodTest >> testSettingIsStub [
277
397
method isStub: true .
0 commit comments