use of org.assertj.core.test.TestClassWithRandomId in project assertj-core by joel-costigliola.
the class Objects_assertIsEqualToIgnoringNullFields_Test method should_pass_when_private_fields_differ_but_are_not_compared.
@Test
public void should_pass_when_private_fields_differ_but_are_not_compared() {
boolean allowedToUsePrivateFields = FieldSupport.comparison().isAllowedToUsePrivateFields();
Assertions.setAllowComparingPrivateFields(false);
TestClassWithRandomId actual = new TestClassWithRandomId("1", 1);
TestClassWithRandomId other = new TestClassWithRandomId(null, 1);
// s field is ignored because null in other, and id also because it is private without public getter
objects.assertIsEqualToIgnoringNullFields(someInfo(), actual, other, noFieldComparators(), defaultTypeComparators());
// reset
Assertions.setAllowComparingPrivateFields(allowedToUsePrivateFields);
}
use of org.assertj.core.test.TestClassWithRandomId in project assertj-core by joel-costigliola.
the class Objects_assertIsEqualToIgnoringGivenFields_Test method should_pass_when_private_fields_differ_but_are_not_compared_or_are_ignored.
@Test
public void should_pass_when_private_fields_differ_but_are_not_compared_or_are_ignored() {
boolean allowedToUsePrivateFields = FieldSupport.comparison().isAllowedToUsePrivateFields();
Assertions.setAllowComparingPrivateFields(false);
TestClassWithRandomId actual = new TestClassWithRandomId("1", 1);
TestClassWithRandomId other = new TestClassWithRandomId("1", 2);
//
objects.assertIsEqualToIgnoringGivenFields(someInfo(), actual, other, noFieldComparators(), defaultTypeComparators(), "n");
// reset
Assertions.setAllowComparingPrivateFields(allowedToUsePrivateFields);
}
Aggregations