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

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

     -- Procedure
    CALL LOADER_REFDATA_NORMALIZE_ENTITIES_REF_SEQUENCE_NOT_NULL(1);

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

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