@Test
public void newModelManager(){

	ModelManagerFactory<TreeModelManager> modelManagerFactory = new ModelManagerFactory<TreeModelManager>(TreeModelManager.class){
		@Override
		public List<Class<? extends TreeModelManager>> getServiceProviderClasses(Class<? extends Model> modelClazz){
			return Arrays.asList(RegressorManager.class, ClassifierManager.class);
		}
	};
	TreeModel treeModel = new TreeModel()
		.setMiningFunction(null)
		.setMiningSchema(new MiningSchema());
	PMML pmml = new PMML()
		.setHeader(new Header())
		.setDataDictionary(new DataDictionary())
		.addModels(treeModel);
	ModelManager<?> modelManager;
	try {
		modelManager = modelManagerFactory.newModelManager(pmml, treeModel);
		fail();
	} catch(InvalidMarkupException ime){
		// Ignored
	}
	treeModel.setMiningFunction(MiningFunction.REGRESSION);
	modelManager = modelManagerFactory.newModelManager(pmml, treeModel);
	assertTrue(modelManager instanceof RegressorManager);
	treeModel.setMiningFunction(MiningFunction.CLASSIFICATION);
	modelManager = modelManagerFactory.newModelManager(pmml, treeModel);
	assertTrue(modelManager instanceof ClassifierManager);
}