Skip to content

Commit

Permalink
add test two methods has one instance (distinct) of the same annotati…
Browse files Browse the repository at this point in the history
…on type
  • Loading branch information
badetitou committed Jun 5, 2024
1 parent 1f43644 commit c6b53a5
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/Famix2Java-Tests/FAMIX2JavaVisitorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1149,3 +1149,43 @@ FAMIX2JavaVisitorTest >> testVisitStaticMethod [
}'
]

{ #category : #test }
FAMIX2JavaVisitorTest >> testVisitTwoMethodsWithAnnotationInstances [

| method methodClass model resultString annotationType anAnnotationInstance method2 anAnnotationInstance2 |
model := FamixJavaModel new.

annotationType := model newAnnotationType.
annotationType name: 'override'.

method := model newMethodNamed: 'aMethod'.
anAnnotationInstance := model newAnnotationInstance.
anAnnotationInstance annotationType: annotationType.
method addAnnotationInstance: anAnnotationInstance.

method2 := model newMethodNamed: 'aMethod2'.
anAnnotationInstance2 := model newAnnotationInstance.
anAnnotationInstance2 annotationType: annotationType.
method2 addAnnotationInstance: anAnnotationInstance2.


methodClass := model newClassNamed: 'MyClass'.
methodClass addMethod: method.
methodClass addMethod: method2.

resultString := String streamContents: [ :stream |
visitor currentStream: stream.
method accept: visitor ].
self assert: resultString equals: '@override
aMethod() {
}'.
resultString := String streamContents: [ :stream |
visitor currentStream: stream.
method2 accept: visitor ].
self assert: resultString equals: '@override
aMethod2() {
}'
]

0 comments on commit c6b53a5

Please sign in to comment.