Delimiter //
/**
 * Test of LOADER_CREDITLIMIT_NORMALIZE_ACCOUNT_REF_NOT_NULL()
 * @test
 */
DROP Procedure IF EXISTS TEST_LOADER_CREDITLIMIT_NORMALIZE_ACCOUNT_REF_NOT_NULL//
Create Procedure TEST_LOADER_CREDITLIMIT_NORMALIZE_ACCOUNT_REF_NOT_NULL()
Begin

    -- initial dataset
    CALL LOADER_CREDITLIMIT_CLEAN();

    CALL LOADER_CREDITLIMIT_PUSH(1, 'ACCOUNTS_REF = ''acc_ref_1'' ', 1, NULL);
    CALL LOADER_CREDITLIMIT_PUSH(2, 'ACCOUNTS_REF = null ', 2, NULL);

     -- Procedure
    CALL LOADER_CREDITLIMIT_NORMALIZE_ACCOUNT_REF_NOT_NULL(1);

    -- Assertions
    CALL utAssert_eq('Data with empty Account Ref are flagged' 
        , 1
        , (SELECT LOADER_STATUS_ERRCOUNT FROM LOADER_STATUS WHERE ID_LOADER_STATUS = 2) 
    );
    CALL utAssert_eq('Data with Accounts Ref are not flagged' 
        , 0
        , (SELECT LOADER_STATUS_ERRCOUNT FROM LOADER_STATUS WHERE ID_LOADER_STATUS = 1) 
    );

    -- clean
    CALL LOADER_CREDITLIMIT_CLEAN();

End //
Delimiter ;
