Closed
Description
Description
No assertions are generated when there are no not reference fields.
To Reproduce
- Set
useAssembleModelGenerator
to false, - Generate a test for the following code:
class FirstClass {
SecondClass secondClass;
FirstClass(SecondClass second) {
this.secondClass = second;
}
}
class SecondClass {
FirstClass firstClass;
SecondClass(FirstClass first) {
this.firstClass = first;
}
}
public class ClassWithCrossReferenceRelationship {
public FirstClass returnFirstClass(int value) {
if (value == 0) {
return new FirstClass(new SecondClass(null));
} else {
FirstClass first = new FirstClass(null);
first.secondClass = new SecondClass(first);
return first;
}
}
}
Expected behavior
Present assertion.
Actual behavior
@Test
@DisplayName("returnFirstClassWithNullableField: value = 0")
public void testReturnFirstClassWithNullableFieldWithCornerCase() throws Exception {
<...>
}
@Test
@DisplayName("returnFirstClassWithNullableField: value = 134217728 (mutated from 0)")
public void testReturnFirstClassWithNullableField() throws Exception {
SampleClass sampleClass = new SampleClass();
FirstClass actual = sampleClass.returnFirstClassWithNullableField(134217728);
FirstClass expected = ((FirstClass) createInstance("codegen.deepequals.FirstClass"));
SecondClass secondClass = ((SecondClass) createInstance("codegen.deepequals.SecondClass"));
secondClass.firstClass = expected;
expected.secondClass = secondClass;
SecondClass expectedSecondClass = expected.secondClass;
SecondClass actualSecondClass = actual.secondClass;
}
There are no asserts in the second generated test.
Metadata
Metadata
Assignees
Type
Projects
Status
Done