public void testBuffered(){
  Instances icopy=new Instances(m_Instances);
  Instances result=null;
  try {
    m_Filter.setInputFormat(icopy);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    fail("Exception thrown on setInputFormat(): \n" + ex.getMessage());
  }
  try {
    result=Filter.useFilter(icopy,m_Filter);
    assertNotNull(result);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    fail("Exception thrown on useFilter(): \n" + ex.getMessage());
  }
  StringWriter sw=new StringWriter(2000);
  sw.write(result.toString());
  assertTrue(icopy.equalHeaders(m_Instances));
  assertEquals(icopy.numInstances(),m_Instances.numInstances());
  Instances result2=null;
  try {
    m_Filter.setInputFormat(icopy);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    fail("Exception thrown on setInputFormat(): \n" + ex.getMessage());
  }
  try {
    result2=Filter.useFilter(icopy,m_Filter);
    assertNotNull(result2);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    fail("Exception thrown on useFilter(): \n" + ex.getMessage());
  }
  assertTrue(icopy.equalHeaders(m_Instances));
  assertEquals(icopy.numInstances(),m_Instances.numInstances());
  assertTrue(result.equalHeaders(result2));
  assertEquals(result.numInstances(),result2.numInstances());
}

public void testBuffered ( ) { Instances icopy = new Instances ( m_Instances ) ; Instances result = null ; try { m_Filter . setInputFormat ( icopy ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; fail ( "Exception thrown on setInputFormat(): \n" + ex . getMessage ( ) ) ; } try { result = Filter . useFilter ( icopy , m_Filter ) ; assertNotNull ( result ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; fail ( "Exception thrown on useFilter(): \n" + ex . getMessage ( ) ) ; } StringWriter sw = new StringWriter ( 2000 ) ; sw . write ( result . toString ( ) ) ; assertTrue ( icopy . equalHeaders ( m_Instances ) ) ; assertEquals ( icopy . numInstances ( ) , m_Instances . numInstances ( ) ) ; Instances result2 = null ; try { m_Filter . setInputFormat ( icopy ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; fail ( "Exception thrown on setInputFormat(): \n" + ex . getMessage ( ) ) ; } try { result2 = Filter . useFilter ( icopy , m_Filter ) ; assertNotNull ( result2 ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; fail ( "Exception thrown on useFilter(): \n" + ex . getMessage ( ) ) ; } assertTrue ( icopy . equalHeaders ( m_Instances ) ) ; assertEquals ( icopy . numInstances ( ) , m_Instances . numInstances ( ) ) ; assertTrue ( result . equalHeaders ( result2 ) ) ; assertEquals ( result . numInstances ( ) , result2 . numInstances ( ) ) ; }
test buffered operation . output instances are only collected after all instances are passed through
