Skip to content

Add new test for deepequals on object with nullable reference fields #696 #698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,13 @@ class DeepEqualsTest : UtValueTestCaseChecker(
coverage = DoNotCalculate
)
}

@Test
fun testClassWithNullableField() {
check(
ClassWithNullableField::returnCompoundWithNullableField,
eq(2),
coverage = DoNotCalculate
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.utbot.examples.codegen.deepequals;

class Component {
int a = 1;
}

class Compound {
Component component;

Compound(Component component) {
this.component = component;
}
}

public class ClassWithNullableField {
public Compound returnCompoundWithNullableField(int value) {
if (value > 0) return new Compound(null);
else return new Compound(new Component());
}
}