**Description** We have to properly handle Kotlin nullable and not-nullable types to produce correct tests: 1. We shouldn't generate models in which value of not-nullable type is `null` 2. We should put `?.` and `!!` in generated files where it is needed. 3. We should properly handle possibly-null values returned by java code. There were some attempts to support this, but this is only partially supported currently. **To Reproduce** There are many cases where behavior is incorrect. For example, launch action on the following class: ```Kotlin class NullabilityIssuesExample(var x: Int) { fun copyWithX(new_x: Int?): NullabilityIssuesExample? { if (new_x == null) return null return NullabilityIssuesExample(x + new_x) } } ``` **Expected behavior** Correct tests are generated. **Actual behavior** Among others, the following test is generated: ```Kotlin fun testCopyWithX2() { val nullabilityIssuesExample = NullabilityIssuesExample(-255) val new_x = -255 val actual = nullabilityIssuesExample.copyWithX(new_x) val expected = NullabilityIssuesExample(0) expected.x = -510 val expectedX = expected.x val actualX = actual.x assertEquals(expectedX, actualX) } ``` **Additional context** This is an old big issue, which may be solved step by step.
Activity