• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / Famix-UnitTest / 8756162640

19 Apr 2024 03:41PM UTC coverage: 36.187% (-0.7%) from 36.931%
8756162640

push

github

Gabriel-Darbord
Exporter: Rename classes + Configurable AssertJ strategy

29 of 118 new or added lines in 9 files covered. (24.58%)

503 of 1390 relevant lines covered (36.19%)

0.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Famix-UnitTest-Exporter/FamixUTAssertJJavaAssertionStrategy.class.st
1
Class {
2
        #name : #FamixUTAssertJJavaAssertionStrategy,
3
        #superclass : #FamixUTAbstractJavaAssertionStrategy,
4
        #instVars : [
5
                'ignoringFieldsOfTypes',
6
                'usingRecursiveComparison',
7
                'ignoringCollectionOrder'
8
        ],
9
        #category : #'Famix-UnitTest-Exporter-Strategies'
10
}
11

12
{ #category : #ast }
NEW
13
FamixUTAssertJJavaAssertionStrategy >> dependencyImportsOn: aFamixUTExporter [
×
NEW
14

×
NEW
15
        | model |
×
NEW
16
        model := aFamixUTExporter model.
×
NEW
17
        ^ { (model newImportDeclaration
×
NEW
18
                   qualifiedName: (model newQualifiedName name:
×
NEW
19
                                            'org.assertj.core.api.Assertions.assertThat');
×
NEW
20
                   isStatic: true) }
×
NEW
21
]
×
22

23
{ #category : #exporting }
NEW
24
FamixUTAssertJJavaAssertionStrategy >> export: aFamixUTAssertion on: exporter [
×
NEW
25
        "Make an assertion using AssertJ: assertThat(actual).isEqualTo(expected)"
×
NEW
26

×
NEW
27
        | model expected assertion containsObject |
×
NEW
28
        model := exporter model.
×
NEW
29
        expected := aFamixUTAssertion expected.
×
NEW
30
        assertion := model newMethodInvocation
×
NEW
31
                             addArgument:
×
NEW
32
                                     (model newVariableExpression name: 'actual');
×
NEW
33
                             name: 'assertThat'.
×
NEW
34
        (self usingRecursiveComparison and: [
×
NEW
35
                 containsObject := expected containsObject ]) ifTrue: [
×
NEW
36
                assertion := model newMethodInvocation
×
NEW
37
                                     receiver: assertion;
×
NEW
38
                                     name: 'usingRecursiveComparison' ].
×
NEW
39
        (self ignoringCollectionOrder and: [ expected containsCollection ])
×
NEW
40
                ifTrue: [
×
NEW
41
                        assertion := model newMethodInvocation
×
NEW
42
                                             receiver: assertion;
×
NEW
43
                                             name: 'ignoringCollectionOrder' ].
×
NEW
44
        (self ignoringFieldsOfTypes isNotEmpty and: [
×
NEW
45
                 containsObject ifNil: [ expected containsObject ] ]) ifTrue: [
×
NEW
46
                assertion := model newMethodInvocation
×
NEW
47
                                     receiver: assertion;
×
NEW
48
                                     name: 'ignoringFieldsOfTypes';
×
NEW
49
                                     arguments:
×
NEW
50
                                             (ignoringFieldsOfTypes collect: [ :typeName |
×
NEW
51
                                                              model newClassProperty
×
NEW
52
                                                                      type: (model newIdentifier name: typeName);
×
NEW
53
                                                                      fieldName: 'class' ]) ].
×
NEW
54
        assertion := model newMethodInvocation
×
NEW
55
                             receiver: assertion;
×
NEW
56
                             addArgument:
×
NEW
57
                                     (exporter valueExporter makeVariableExpression:
×
NEW
58
                                                      expected);
×
NEW
59
                             name: 'isEqualTo'.
×
NEW
60
        ^ model newExpressionStatement expression: assertion
×
NEW
61
]
×
62

63
{ #category : #accessing }
NEW
64
FamixUTAssertJJavaAssertionStrategy >> ignoringCollectionOrder [
×
NEW
65

×
NEW
66
        ^ ignoringCollectionOrder ifNil: [ ignoringCollectionOrder := false ]
×
NEW
67
]
×
68

69
{ #category : #accessing }
NEW
70
FamixUTAssertJJavaAssertionStrategy >> ignoringCollectionOrder: aBoolean [
×
NEW
71

×
NEW
72
        ignoringCollectionOrder := aBoolean
×
NEW
73
]
×
74

75
{ #category : #accessing }
NEW
76
FamixUTAssertJJavaAssertionStrategy >> ignoringFieldsOfTypes [
×
NEW
77

×
NEW
78
        ^ ignoringFieldsOfTypes ifNil: [ ignoringFieldsOfTypes := {  } ]
×
NEW
79
]
×
80

81
{ #category : #accessing }
NEW
82
FamixUTAssertJJavaAssertionStrategy >> ignoringFieldsOfTypes: aCollection [
×
NEW
83

×
NEW
84
        ignoringFieldsOfTypes := aCollection
×
NEW
85
]
×
86

87
{ #category : #accessing }
NEW
88
FamixUTAssertJJavaAssertionStrategy >> usingRecursiveComparison [
×
NEW
89

×
NEW
90
        ^ usingRecursiveComparison ifNil: [
×
NEW
91
                  usingRecursiveComparison := false ]
×
NEW
92
]
×
93

94
{ #category : #accessing }
NEW
95
FamixUTAssertJJavaAssertionStrategy >> usingRecursiveComparison: aBoolean [
×
NEW
96

×
NEW
97
        usingRecursiveComparison := aBoolean
×
NEW
98
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc