@@ -28,107 +28,107 @@ private static Stream<Arguments> splitTestArguments() {
28
28
List <TestState > availableTestState = new ArrayList <>();
29
29
List <Arguments > activeArguments = new ArrayList <>();
30
30
31
- // availableTestState.add(new TestState(
32
- // "#02: Multiple shallow properties using SUT and defaults",
33
- // A1_Number_of_properties.MULTIPLE_PROPERTIES,
34
- // null, null, null, null,
35
- // null, C2_last_instance_is_null.NON_NULL_LAST_INSTANCE,
36
- // true
37
- // ).addProperty(new PropertyState(
38
- // "1",
39
- // A2_1_depth.DEPTH_ZERO,
40
- // A2_2_number_of_values.ONE_VALUE,
41
- // A2_3_type_of_values.PRIMITIVE,
42
- // A2_4_SUT_or_defaults.ONLY_IN_SUT,
43
- // B5_1_deepest_setter.WITH_DEEPEST_SETTER,
44
- // B5_2_number_of_parameter_of_deepest_setter.SETTER_NEEDS_SAME_VALUES,
45
- // B5_3_parsable_for_setter.PARSABLE_FOR_SETTER,
46
- // B5_4_deepest_public_attribute.WITHOUT_DEEPEST_PUBLIC_ATTRIBUTE,
47
- // null,
48
- // EnumSet.of(ExpectedFlags.SET, ExpectedFlags.FINAL_SETTER)
49
- // )).addProperty(new PropertyState(
50
- // "2",
51
- // A2_1_depth.DEPTH_ZERO,
52
- // A2_2_number_of_values.ONE_VALUE,
53
- // A2_3_type_of_values.STRING,
54
- // A2_4_SUT_or_defaults.ONLY_IN_DEFAULTS,
55
- // B5_1_deepest_setter.WITHOUT_DEEPEST_SETTER,
56
- // null,
57
- // null,
58
- // B5_4_deepest_public_attribute.WITH_DEEPEST_PUBLIC_ATTRIBUTE,
59
- // B5_5_parsable_for_public_attribute.PARSABLE_FOR_PUBLIC_ATTRIBUTE,
60
- // EnumSet.of(ExpectedFlags.SET, ExpectedFlags.FINAL_PUBLIC)
61
- // )));
62
- //
63
- // availableTestState.add(new TestState(
64
- // "#03: Multiple deep properties, with getter",
65
- // A1_Number_of_properties.MULTIPLE_PROPERTIES,
66
- // B1_intermediate_getter.WITH_INTERMEDIATE_GETTER,
67
- // B2_intermediate_setter.WITH_INTERMEDIATE_SETTER,
68
- // B3_intermediate_public_attributes.WITHOUT_INTERMEDIATE_PUBLIC_ATTRIBUTES,
69
- // B4_intermediate_javabean_constructor.WITHOUT_JAVABEAN_CONSTRUCTOR,
70
- // C1_intermediate_instances_are_null.NON_NULL_INTERMEDIATE_INSTANCES,
71
- // C2_last_instance_is_null.NON_NULL_LAST_INSTANCE,
72
- // true
73
- // ).addProperty(new PropertyState(
74
- // "1",
75
- // A2_1_depth.DEPTH_GREATER_THAN_ZERO,
76
- // A2_2_number_of_values.ONE_VALUE,
77
- // A2_3_type_of_values.PRIMITIVE,
78
- // A2_4_SUT_or_defaults.BOTH_SUT_AND_DEFAULTS,
79
- // B5_1_deepest_setter.WITH_DEEPEST_SETTER,
80
- // B5_2_number_of_parameter_of_deepest_setter.SETTER_NEEDS_SAME_VALUES,
81
- // B5_3_parsable_for_setter.PARSABLE_FOR_SETTER,
82
- // B5_4_deepest_public_attribute.WITHOUT_DEEPEST_PUBLIC_ATTRIBUTE,
83
- // null,
84
- // EnumSet.of(ExpectedFlags.SET, ExpectedFlags.VIA_GETTER, ExpectedFlags.FINAL_SETTER)
85
- // )).addProperty(new PropertyState(
86
- // "2",
87
- // A2_1_depth.DEPTH_GREATER_THAN_ZERO,
88
- // A2_2_number_of_values.ONE_VALUE,
89
- // A2_3_type_of_values.SPECIAL_CLASS,
90
- // A2_4_SUT_or_defaults.ONLY_IN_SUT,
91
- // B5_1_deepest_setter.WITHOUT_DEEPEST_SETTER,
92
- // null, null,
93
- // B5_4_deepest_public_attribute.WITH_DEEPEST_PUBLIC_ATTRIBUTE,
94
- // B5_5_parsable_for_public_attribute.PARSABLE_FOR_PUBLIC_ATTRIBUTE,
95
- // EnumSet.of(ExpectedFlags.SET, ExpectedFlags.VIA_GETTER, ExpectedFlags.FINAL_PUBLIC)
96
- // )));
97
- //
98
- // availableTestState.add(new TestState(
99
- // "#04: Multiple deep properties, with getter returning null",
100
- // A1_Number_of_properties.MULTIPLE_PROPERTIES,
101
- // B1_intermediate_getter.WITH_INTERMEDIATE_GETTER,
102
- // B2_intermediate_setter.WITH_INTERMEDIATE_SETTER,
103
- // B3_intermediate_public_attributes.WITHOUT_INTERMEDIATE_PUBLIC_ATTRIBUTES,
104
- // B4_intermediate_javabean_constructor.WITH_JAVABEAN_CONSTRUCTOR,
105
- // C1_intermediate_instances_are_null.NULL_INTERMEDIATE_INSTANCES,
106
- // C2_last_instance_is_null.NULL_LAST_INSTANCE,
107
- // true
108
- // ).addProperty(new PropertyState(
109
- // "1",
110
- // A2_1_depth.DEPTH_GREATER_THAN_ZERO,
111
- // A2_2_number_of_values.ONE_VALUE,
112
- // A2_3_type_of_values.PRIMITIVE,
113
- // A2_4_SUT_or_defaults.ONLY_IN_SUT,
114
- // B5_1_deepest_setter.WITH_DEEPEST_SETTER,
115
- // B5_2_number_of_parameter_of_deepest_setter.SETTER_NEEDS_SAME_VALUES,
116
- // B5_3_parsable_for_setter.PARSABLE_FOR_SETTER,
117
- // B5_4_deepest_public_attribute.WITHOUT_DEEPEST_PUBLIC_ATTRIBUTE,
118
- // null,
119
- // EnumSet.of(ExpectedFlags.SET, ExpectedFlags.VIA_NEW_SETTER_GETTER, ExpectedFlags.FINAL_SETTER)
120
- // )).addProperty(new PropertyState(
121
- // "2",
122
- // A2_1_depth.DEPTH_GREATER_THAN_ZERO,
123
- // A2_2_number_of_values.ONE_VALUE,
124
- // A2_3_type_of_values.PRIMITIVE,
125
- // A2_4_SUT_or_defaults.ONLY_IN_SUT,
126
- // B5_1_deepest_setter.WITHOUT_DEEPEST_SETTER,
127
- // null, null,
128
- // B5_4_deepest_public_attribute.WITH_DEEPEST_PUBLIC_ATTRIBUTE,
129
- // B5_5_parsable_for_public_attribute.PARSABLE_FOR_PUBLIC_ATTRIBUTE,
130
- // EnumSet.of(ExpectedFlags.SET, ExpectedFlags.VIA_NEW_SETTER_GETTER, ExpectedFlags.FINAL_PUBLIC)
131
- // )));
31
+ availableTestState .add (new TestState (
32
+ "#02: Multiple shallow properties using SUT and defaults" ,
33
+ A1_Number_of_properties .MULTIPLE_PROPERTIES ,
34
+ null , null , null , null ,
35
+ null , C2_last_instance_is_null .NON_NULL_LAST_INSTANCE ,
36
+ true
37
+ ).addProperty (new PropertyState (
38
+ "1" ,
39
+ A2_1_depth .DEPTH_ZERO ,
40
+ A2_2_number_of_values .ONE_VALUE ,
41
+ A2_3_type_of_values .PRIMITIVE ,
42
+ A2_4_SUT_or_defaults .ONLY_IN_SUT ,
43
+ B5_1_deepest_setter .WITH_DEEPEST_SETTER ,
44
+ B5_2_number_of_parameter_of_deepest_setter .SETTER_NEEDS_SAME_VALUES ,
45
+ B5_3_parsable_for_setter .PARSABLE_FOR_SETTER ,
46
+ B5_4_deepest_public_attribute .WITHOUT_DEEPEST_PUBLIC_ATTRIBUTE ,
47
+ null ,
48
+ EnumSet .of (ExpectedFlags .SET , ExpectedFlags .FINAL_SETTER )
49
+ )).addProperty (new PropertyState (
50
+ "2" ,
51
+ A2_1_depth .DEPTH_ZERO ,
52
+ A2_2_number_of_values .ONE_VALUE ,
53
+ A2_3_type_of_values .STRING ,
54
+ A2_4_SUT_or_defaults .ONLY_IN_DEFAULTS ,
55
+ B5_1_deepest_setter .WITHOUT_DEEPEST_SETTER ,
56
+ null ,
57
+ null ,
58
+ B5_4_deepest_public_attribute .WITH_DEEPEST_PUBLIC_ATTRIBUTE ,
59
+ B5_5_parsable_for_public_attribute .PARSABLE_FOR_PUBLIC_ATTRIBUTE ,
60
+ EnumSet .of (ExpectedFlags .SET , ExpectedFlags .FINAL_PUBLIC )
61
+ )));
62
+
63
+ availableTestState .add (new TestState (
64
+ "#03: Multiple deep properties, with getter" ,
65
+ A1_Number_of_properties .MULTIPLE_PROPERTIES ,
66
+ B1_intermediate_getter .WITH_INTERMEDIATE_GETTER ,
67
+ B2_intermediate_setter .WITH_INTERMEDIATE_SETTER ,
68
+ B3_intermediate_public_attributes .WITHOUT_INTERMEDIATE_PUBLIC_ATTRIBUTES ,
69
+ B4_intermediate_javabean_constructor .WITHOUT_JAVABEAN_CONSTRUCTOR ,
70
+ C1_intermediate_instances_are_null .NON_NULL_INTERMEDIATE_INSTANCES ,
71
+ C2_last_instance_is_null .NON_NULL_LAST_INSTANCE ,
72
+ true
73
+ ).addProperty (new PropertyState (
74
+ "1" ,
75
+ A2_1_depth .DEPTH_GREATER_THAN_ZERO ,
76
+ A2_2_number_of_values .ONE_VALUE ,
77
+ A2_3_type_of_values .PRIMITIVE ,
78
+ A2_4_SUT_or_defaults .BOTH_SUT_AND_DEFAULTS ,
79
+ B5_1_deepest_setter .WITH_DEEPEST_SETTER ,
80
+ B5_2_number_of_parameter_of_deepest_setter .SETTER_NEEDS_SAME_VALUES ,
81
+ B5_3_parsable_for_setter .PARSABLE_FOR_SETTER ,
82
+ B5_4_deepest_public_attribute .WITHOUT_DEEPEST_PUBLIC_ATTRIBUTE ,
83
+ null ,
84
+ EnumSet .of (ExpectedFlags .SET , ExpectedFlags .VIA_GETTER , ExpectedFlags .FINAL_SETTER )
85
+ )).addProperty (new PropertyState (
86
+ "2" ,
87
+ A2_1_depth .DEPTH_GREATER_THAN_ZERO ,
88
+ A2_2_number_of_values .ONE_VALUE ,
89
+ A2_3_type_of_values .SPECIAL_CLASS ,
90
+ A2_4_SUT_or_defaults .ONLY_IN_SUT ,
91
+ B5_1_deepest_setter .WITHOUT_DEEPEST_SETTER ,
92
+ null , null ,
93
+ B5_4_deepest_public_attribute .WITH_DEEPEST_PUBLIC_ATTRIBUTE ,
94
+ B5_5_parsable_for_public_attribute .PARSABLE_FOR_PUBLIC_ATTRIBUTE ,
95
+ EnumSet .of (ExpectedFlags .SET , ExpectedFlags .VIA_GETTER , ExpectedFlags .FINAL_PUBLIC )
96
+ )));
97
+
98
+ availableTestState .add (new TestState (
99
+ "#04: Multiple deep properties, with getter returning null" ,
100
+ A1_Number_of_properties .MULTIPLE_PROPERTIES ,
101
+ B1_intermediate_getter .WITH_INTERMEDIATE_GETTER ,
102
+ B2_intermediate_setter .WITH_INTERMEDIATE_SETTER ,
103
+ B3_intermediate_public_attributes .WITHOUT_INTERMEDIATE_PUBLIC_ATTRIBUTES ,
104
+ B4_intermediate_javabean_constructor .WITH_JAVABEAN_CONSTRUCTOR ,
105
+ C1_intermediate_instances_are_null .NULL_INTERMEDIATE_INSTANCES ,
106
+ C2_last_instance_is_null .NULL_LAST_INSTANCE ,
107
+ true
108
+ ).addProperty (new PropertyState (
109
+ "1" ,
110
+ A2_1_depth .DEPTH_GREATER_THAN_ZERO ,
111
+ A2_2_number_of_values .ONE_VALUE ,
112
+ A2_3_type_of_values .PRIMITIVE ,
113
+ A2_4_SUT_or_defaults .ONLY_IN_SUT ,
114
+ B5_1_deepest_setter .WITH_DEEPEST_SETTER ,
115
+ B5_2_number_of_parameter_of_deepest_setter .SETTER_NEEDS_SAME_VALUES ,
116
+ B5_3_parsable_for_setter .PARSABLE_FOR_SETTER ,
117
+ B5_4_deepest_public_attribute .WITHOUT_DEEPEST_PUBLIC_ATTRIBUTE ,
118
+ null ,
119
+ EnumSet .of (ExpectedFlags .SET , ExpectedFlags .VIA_NEW_SETTER_GETTER , ExpectedFlags .FINAL_SETTER )
120
+ )).addProperty (new PropertyState (
121
+ "2" ,
122
+ A2_1_depth .DEPTH_GREATER_THAN_ZERO ,
123
+ A2_2_number_of_values .ONE_VALUE ,
124
+ A2_3_type_of_values .PRIMITIVE ,
125
+ A2_4_SUT_or_defaults .ONLY_IN_SUT ,
126
+ B5_1_deepest_setter .WITHOUT_DEEPEST_SETTER ,
127
+ null , null ,
128
+ B5_4_deepest_public_attribute .WITH_DEEPEST_PUBLIC_ATTRIBUTE ,
129
+ B5_5_parsable_for_public_attribute .PARSABLE_FOR_PUBLIC_ATTRIBUTE ,
130
+ EnumSet .of (ExpectedFlags .SET , ExpectedFlags .VIA_NEW_SETTER_GETTER , ExpectedFlags .FINAL_PUBLIC )
131
+ )));
132
132
133
133
availableTestState .add (new TestState (
134
134
"#05: Multiple deep properties, w/o getter and with setter" ,
@@ -165,6 +165,41 @@ private static Stream<Arguments> splitTestArguments() {
165
165
EnumSet .of (ExpectedFlags .SET , ExpectedFlags .VIA_NEW_SETTER , ExpectedFlags .FINAL_PUBLIC )
166
166
)));
167
167
168
+ availableTestState .add (new TestState (
169
+ "#06: Multiple deep properties, w/o getter and w/o setter and null attributes" ,
170
+ A1_Number_of_properties .MULTIPLE_PROPERTIES ,
171
+ B1_intermediate_getter .WITHOUT_INTERMEDIATE_GETTER ,
172
+ B2_intermediate_setter .WITHOUT_INTERMEDIATE_SETTER ,
173
+ B3_intermediate_public_attributes .WITH_INTERMEDIATE_PUBLIC_ATTRIBUTES ,
174
+ B4_intermediate_javabean_constructor .WITH_JAVABEAN_CONSTRUCTOR ,
175
+ C1_intermediate_instances_are_null .NULL_INTERMEDIATE_INSTANCES ,
176
+ C2_last_instance_is_null .NULL_LAST_INSTANCE ,
177
+ false
178
+ ).addProperty (new PropertyState (
179
+ "1" ,
180
+ A2_1_depth .DEPTH_GREATER_THAN_ZERO ,
181
+ A2_2_number_of_values .ONE_VALUE ,
182
+ A2_3_type_of_values .PRIMITIVE ,
183
+ A2_4_SUT_or_defaults .ONLY_IN_SUT ,
184
+ B5_1_deepest_setter .WITH_DEEPEST_SETTER ,
185
+ B5_2_number_of_parameter_of_deepest_setter .SETTER_NEEDS_SAME_VALUES ,
186
+ B5_3_parsable_for_setter .PARSABLE_FOR_SETTER ,
187
+ B5_4_deepest_public_attribute .WITHOUT_DEEPEST_PUBLIC_ATTRIBUTE ,
188
+ null ,
189
+ EnumSet .of (ExpectedFlags .SET , ExpectedFlags .VIA_NEW_PUBLIC , ExpectedFlags .FINAL_SETTER )
190
+ )).addProperty (new PropertyState (
191
+ "2" ,
192
+ A2_1_depth .DEPTH_GREATER_THAN_ZERO ,
193
+ A2_2_number_of_values .ONE_VALUE ,
194
+ A2_3_type_of_values .PRIMITIVE ,
195
+ A2_4_SUT_or_defaults .ONLY_IN_SUT ,
196
+ B5_1_deepest_setter .WITHOUT_DEEPEST_SETTER ,
197
+ null , null ,
198
+ B5_4_deepest_public_attribute .WITH_DEEPEST_PUBLIC_ATTRIBUTE ,
199
+ B5_5_parsable_for_public_attribute .PARSABLE_FOR_PUBLIC_ATTRIBUTE ,
200
+ EnumSet .of (ExpectedFlags .SET , ExpectedFlags .VIA_NEW_PUBLIC , ExpectedFlags .FINAL_PUBLIC )
201
+ )));
202
+
168
203
for (TestState state : availableTestState ) {
169
204
if (!state .successful )
170
205
if (("pitest" .equals (envFlag ) || "onlySuccess" .equals (envFlag )))
@@ -187,9 +222,12 @@ public void setIntoTest(TestState testState) {
187
222
188
223
Options unsetOptions = testState .SUT .setInto (testState .obj );
189
224
225
+ logger .info ("setInto done" );
226
+
190
227
List <String > calledMethods = MyOptionsMethodTracker .getMethods ();
191
228
192
- logger .info ("setInto done" );
229
+ logger .info (String .valueOf (calledMethods ));
230
+
193
231
194
232
DeepestInterface deepestObject = ((AnyDeepInterface ) testState .obj ).intermediateGetDeepest ();
195
233
for (PropertyState property : testState .properties ) {
@@ -241,6 +279,12 @@ public void setIntoTest(TestState testState) {
241
279
Assertions .assertTrue (verify ("setDeeper" ));
242
280
Assertions .assertFalse (verify ("getDeepest" ));
243
281
Assertions .assertTrue (verify ("setDeepest" ));
282
+ } else if (property .expectedSet .contains (ExpectedFlags .VIA_NEW_PUBLIC )) {
283
+ Assertions .assertTrue (verify ("new IntermediateInterface" ));
284
+ Assertions .assertFalse (verify ("getDeeper" ));
285
+ Assertions .assertFalse (verify ("setDeeper" ));
286
+ Assertions .assertFalse (verify ("getDeepest" ));
287
+ Assertions .assertFalse (verify ("setDeepest" ));
244
288
}
245
289
246
290
/* Assert the correct final way has been used to set the attribute */
0 commit comments