eclipse / jnosql

Eclipse JNoSQL is a framework which has the goal to help Java developers to create Jakarta EE applications with NoSQL.
Other
229 stars 72 forks source link

Fixed test assertions in order to improve the test coverage #326

Closed dearrudam closed 1 year ago

dearrudam commented 1 year ago

Fixed test assertions to use assertFalse assertion method because assertEquals assertion method doesn't call the target object equals method when the 1st provided parameter is null:

FYI, here are some snippet codes from the Junit Jupiter Assertions API that I'm talking about:

The org.junit.jupiter.api.AssertEquals.assertEquals() method:

    static void assertEquals(Object expected, Object actual, Supplier<String> messageSupplier) {
        if (!objectsAreEqual(expected, actual)) {
            failNotEqual(expected, actual, messageSupplier);
        }
    }

And the org.junit.jupiter.api.AssertionUtils.objectsAreEqual():

    static boolean objectsAreEqual(Object obj1, Object obj2) {
        if (obj1 == null) {
            return (obj2 == null);
        }
        return obj1.equals(obj2);
    }

@otaviojava, could you review this PR, please?

genie-jnosql commented 1 year ago

Can one of the admins verify this patch?