Add complex case tests and factory