Delimiter //
/**
 * Test of LOADER_CREDITLIMIT_NORMALIZE_MAP_DATE_NOT_PROVIDED()
 * @test
 */
Drop Procedure If Exists TEST_LOADER_CREDITLIMIT_NORMALIZE_MAP_DATE_NOT_PROVIDED//
Create Procedure TEST_LOADER_CREDITLIMIT_NORMALIZE_MAP_DATE_NOT_PROVIDED(
)
Begin

    -- initial dataset
    CALL LOADER_CREDITLIMIT_CLEAN();

    CALL LOADER_CREDITLIMIT_PUSH(1, 'CREDIT_LIMIT_DATE = NULL, ID_CREDIT_LIMIT_NEW = 1 ', 1, NULL);
    CALL LOADER_CREDITLIMIT_PUSH(2, 'CREDIT_LIMIT_DATE = ''2014-12-09'', ID_CREDIT_LIMIT_NEW = 1 ', 2, NULL);
    
    -- Tested procedure
    Call LOADER_CREDITLIMIT_NORMALIZE_MAP_DATE_NOT_PROVIDED(1);

    -- Assertions
    Call utAssert_eq('When the date is not provided, row receives current date'
        , CURDATE()
        , (Select CREDIT_LIMIT_DATE From LOADER_CREDITLIMIT Where ID_LOADER_CREDITLIMIT = 1)
    );
    Call utAssert_eq('When the date is provided, row does not receive current date'
        , DATE('2014-12-09')
        , (Select CREDIT_LIMIT_DATE From LOADER_CREDITLIMIT Where ID_LOADER_CREDITLIMIT = 2)
    );

    -- Clean
    Call LOADER_CREDITLIMIT_CLEAN();
    Call LOADER_TEST_MOCK_INFO_CLEAN();

End//
Delimiter ;