Delimiter //
/**
 * @test
 * Test For LOADER_REFDATA_NORMALIZE_ACCOUNT_REF_NOT_NULL()
 */
DROP Procedure IF EXISTS TEST_LOADER_REFDATA_NORMALIZE_ACCOUNT_REF_NOT_NULL//
Create Procedure TEST_LOADER_REFDATA_NORMALIZE_ACCOUNT_REF_NOT_NULL()
Begin
    -- initial dataset
    CALL LOADER_REFDATA_CLEAN();

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

     -- Procedure
    CALL LOADER_REFDATA_NORMALIZE_ACCOUNT_REF_NOT_NULL(1);

    -- Assertions
    CALL utAssert_eq('data with empty accouts ref are flagged' 
        , 1
        , (SELECT LOADER_STATUS_ERRCOUNT FROM LOADER_STATUS WHERE ID_LOADER_STATUS = 2) 
    );
    CALL utAssert_eq('data with not empty accouts ref are not flagged' 
        , 0
        , (SELECT LOADER_STATUS_ERRCOUNT FROM LOADER_STATUS WHERE ID_LOADER_STATUS = 1) 
    );

    -- clean
    CALL LOADER_REFDATA_CLEAN();
End //
Delimiter ;
