protected void performTest(boolean nomClass) {
    TestInstances	test;
    Instances		data;
    double[]		originalResults;
    double[]		testResults;
    int			i;

    // generate data
    try {
      test = new TestInstances();
      if (nomClass) {
	test.setClassType(Attribute.NOMINAL);
	test.setNumNominal(5);
	test.setNumNominalValues(4);
	test.setNumNumeric(0);
      }
      else {
	test.setClassType(Attribute.NUMERIC);
	test.setNumNominal(0);
	test.setNumNumeric(5);
      }
      test.setNumDate(0);
      test.setNumString(0);
      test.setNumRelational(0);
      test.setNumInstances(100);
      data = test.generate();
    }
    catch (Exception e) {
      fail("Generating test data failed: " + e);
      return;
    }
    
    // train and save base classifier
    try {
      originalResults = trainAndSerializeClassifier(data);
    }
    catch (Exception e) {
      fail("Training base classifier failed: " + e);
      return;
    }
    
    // test loading
    try {
      m_Classifier = new SerializedClassifier();
      m_Classifier.setModelFile(new File(MODEL_FILENAME));
      m_Classifier.buildClassifier(data);
    }
    catch (Exception e) {
      fail("Loading/testing of classifier failed: " + e);
    }
    
    // compare results
    try {
      // get results from serialized model
      testResults = new double[data.numInstances()];
      for (i = 0; i < testResults.length; i++)
	testResults[i] = m_Classifier.classifyInstance(data.instance(i));
      
      // compare
      for (i = 0; i < originalResults.length; i++) {
	if (originalResults[i] != testResults[i])
	  throw new Exception("Result #" + (i+1) + " differs!");
      }
    }
    catch (Exception e) {
      fail("Comparing results failed: " + e);
    }
  }