This assert is just to make sure that in the next step the exception will be thrown. If factory==null, the test case works wrong