Failing tests for empty import directories

Reproduces #932.
Add ImportTaskFactory class

Removes duplication and makes code leaner. Also fixes #932.