Skip to content

Commit

Permalink
Suppress usage of "lenient" term in field by field comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-costigliola committed Aug 27, 2015
1 parent d9f63dc commit 30f24df
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Expand Up @@ -65,7 +65,7 @@ protected AbstractObjectAssert(A actual, Class<?> selfType) {
* @throws AssertionError if the other object is not an instance of the actual type.
*/
public S isEqualToIgnoringNullFields(A other) {
objects.assertIsLenientEqualsToIgnoringNullFields(info, actual, other);
objects.assertIsEqualToIgnoringNullFields(info, actual, other);
return myself;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/assertj/core/internal/Objects.java
Expand Up @@ -535,7 +535,7 @@ private boolean isActualIn(Object actual, Iterable<?> values) {
* @throws AssertionError if the actual and the given object are not lenient equals.
* @throws AssertionError if the other object is not an instance of the actual type.
*/
public <A> void assertIsLenientEqualsToIgnoringNullFields(AssertionInfo info, A actual, A other) {
public <A> void assertIsEqualToIgnoringNullFields(AssertionInfo info, A actual, A other) {
assertNotNull(info, actual);
assertOtherTypeIsCompatibleWithActualClass(info, other, actual.getClass());
List<String> fieldsNames = new LinkedList<>();
Expand Down
Expand Up @@ -12,20 +12,20 @@
*/
package org.assertj.core.api.object;

import static org.mockito.Mockito.verify;

import org.assertj.core.api.ObjectAssert;
import org.assertj.core.api.ObjectAssertBaseTest;
import org.assertj.core.test.Jedi;

import static org.mockito.Mockito.verify;


/**
* Tests for <code>{@link ObjectAssert#isEqualToComparingOnlyGivenFields(Object, String...)}</code>.
*
* @author Nicolas François
* @author Mikhail Mazursky
*/
public class ObjectAssert_isLenientEqualsToByAcceptingFields_Test extends ObjectAssertBaseTest {
public class ObjectAssert_isEqualToComparingOnlyGivenFields_Test extends ObjectAssertBaseTest {

private Jedi other = new Jedi("Yoda", "Blue");

Expand Down
Expand Up @@ -25,7 +25,7 @@
* @author Nicolas François
* @author Mikhail Mazursky
*/
public class ObjectAssert_isLenientEqualsToByIgnoringNullFields_Test extends ObjectAssertBaseTest {
public class ObjectAssert_isEqualToIgnoringNullFields_Test extends ObjectAssertBaseTest {

private Jedi other = new Jedi("Yoda", "Green");

Expand All @@ -36,6 +36,6 @@ protected ObjectAssert<Jedi> invoke_api_method() {

@Override
protected void verify_internal_effects() {
verify(objects).assertIsLenientEqualsToIgnoringNullFields(getInfo(assertions), getActual(assertions), other);
verify(objects).assertIsEqualToIgnoringNullFields(getInfo(assertions), getActual(assertions), other);
}
}
Expand Up @@ -39,7 +39,7 @@
* @author Nicolas François
* @author Joel Costigliola
*/
public class Objects_assertIsLenientEqualsToByIgnoringFields_Test extends ObjectsBaseTest {
public class Objects_assertIsEqualToIgnoringGivenFields_Test extends ObjectsBaseTest {

@Test
public void should_pass_when_fields_are_equal() {
Expand Down
Expand Up @@ -35,27 +35,27 @@
* @author Nicolas François
* @author Joel Costigliola
*/
public class Objects_assertIsLenientEqualsToByIgnoringNullFields_Test extends ObjectsBaseTest {
public class Objects_assertIsEqualToIgnoringNullFields_Test extends ObjectsBaseTest {

@Test
public void should_pass_when_fields_are_equal() {
Jedi actual = new Jedi("Yoda", "Green");
Jedi other = new Jedi("Yoda", "Green");
objects.assertIsLenientEqualsToIgnoringNullFields(someInfo(), actual, other);
objects.assertIsEqualToIgnoringNullFields(someInfo(), actual, other);
}

@Test
public void should_pass_when_some_other_field_is_null_but_not_actual() {
Jedi actual = new Jedi("Yoda", "Green");
Jedi other = new Jedi("Yoda", null);
objects.assertIsLenientEqualsToIgnoringNullFields(someInfo(), actual, other);
objects.assertIsEqualToIgnoringNullFields(someInfo(), actual, other);
}

@Test
public void should_fail_if_actual_is_null() {
thrown.expectAssertionError(actualIsNull());
Jedi other = new Jedi("Yoda", "Green");
objects.assertIsLenientEqualsToIgnoringNullFields(someInfo(), null, other);
objects.assertIsEqualToIgnoringNullFields(someInfo(), null, other);
}

@Test
Expand All @@ -64,7 +64,7 @@ public void should_fail_when_some_actual_field_is_null_but_not_other() {
Jedi actual = new Jedi("Yoda", null);
Jedi other = new Jedi("Yoda", "Green");
try {
objects.assertIsLenientEqualsToIgnoringNullFields(info, actual, other);
objects.assertIsEqualToIgnoringNullFields(info, actual, other);
} catch (AssertionError err) {
verify(failures).failure(info,
shouldBeEqualToIgnoringGivenFields(actual, newArrayList("lightSaberColor"),
Expand All @@ -82,7 +82,7 @@ public void should_fail_when_a_field_differ() {
Jedi actual = new Jedi("Yoda", "Green");
Jedi other = new Jedi("Soda", "Green");
try {
objects.assertIsLenientEqualsToIgnoringNullFields(info, actual, other);
objects.assertIsEqualToIgnoringNullFields(info, actual, other);
} catch (AssertionError err) {
verify(failures).failure(info,
shouldBeEqualToIgnoringGivenFields(actual, newArrayList("name"),
Expand All @@ -100,7 +100,7 @@ public void should_fail_when_objects_to_compare_are_of_different_types() {
Jedi actual = new Jedi("Yoda", "Green");
Employee other = new Employee();
try {
objects.assertIsLenientEqualsToIgnoringNullFields(info, actual, other);
objects.assertIsEqualToIgnoringNullFields(info, actual, other);
} catch (AssertionError err) {
verify(failures).failure(info, shouldBeInstance(other, actual.getClass()));
return;
Expand All @@ -115,7 +115,7 @@ public void should_pass_when_private_fields_differ_but_are_not_compared() {
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.assertIsLenientEqualsToIgnoringNullFields(someInfo(), actual, other);
objects.assertIsEqualToIgnoringNullFields(someInfo(), actual, other);
// reset
Assertions.setAllowComparingPrivateFields(allowedToUsePrivateFields);
}
Expand Down

0 comments on commit 30f24df

Please sign in to comment.