Skip to main content

Test expectations should not be redundant

From the utPLSQL documentation:

Validation of the code under test (the tested logic of procedure/function etc.) is performed by comparing the actual data against the expected data. utPLSQL uses a combination of expectation and matcher to perform the check on the data.

Some validations are written in the form of ut.expect(actual_value).matcher(expected_value). This rules checks if the actual_value and the expected_value are the same thing. Example:

...
begin
v_expected := '2345';
v_actual := betwnstr('1234567', 2, 5);
ut.expect(v_actual).to_equal(v_actual); -- This expectation is wrong, it's always true
end;