Delimiter //
/**
 * Test of LOADER_GUARANTEED_NORMALIZE_MAP_DATE_NOT_PROVIDED()
 * @test
 */
Drop Procedure If Exists TEST_LOADER_GUARANTEED_NORMALIZE_MAP_DATE_NOT_PROVIDED//
Create Procedure TEST_LOADER_GUARANTEED_NORMALIZE_MAP_DATE_NOT_PROVIDED(
)
Begin

    -- initial dataset
    CALL LOADER_GUARANTEED_CLEAN();

    CALL LOADER_GUARANTEED_PUSH(1, 'GUARANTEED_CREAT_DATE = NULL, ID_GUARANTEED_NEW = 1 ', 1, NULL);
    CALL LOADER_GUARANTEED_PUSH(2, 'GUARANTEED_CREAT_DATE = ''2014-12-09'', ID_GUARANTEED_NEW = 1 ', 2, NULL);
    
    -- Tested procedure
    Call LOADER_GUARANTEED_NORMALIZE_MAP_DATE_NOT_PROVIDED(1);

    -- Assertions
    Call utAssert_eq('When the date is not provided, row receives current date'
        , TIMESTAMP(CURDATE())
        , (Select GUARANTEED_CREAT_DATE From LOADER_GUARANTEED Where ID_LOADER_GUARANTEED = 1)
    );
    Call utAssert_eq('When the date is provided, row does not receive current date'
        , TIMESTAMP('2014-12-09')
        , (Select GUARANTEED_CREAT_DATE From LOADER_GUARANTEED Where ID_LOADER_GUARANTEED = 2)
    );

    -- Clean
    Call LOADER_GUARANTEED_CLEAN();
    Call LOADER_TEST_MOCK_INFO_CLEAN();

End//
Delimiter ;