// Path: src/test/java/com/linuxense/javadbf/mocks/NullOutputStream.java
// public class NullOutputStream extends OutputStream {
//     
// 	private long count = 0;
// 	
// 
//     /**
//      * Constructor
//      */
//     public NullOutputStream() {
//         super();
//     }
//     /**
//      * Does nothing - output to <code>/dev/null</code>.
//      * @param b The bytes to write
//      * @param off The start offset
//      * @param len The number of bytes to write
//      */
//     @Override
//     public void write(byte[] b, int off, int len) {
//         this.count+= len;
//     }
// 
//     /**
//      * Does nothing - output to <code>/dev/null</code>.
//      * @param b The byte to write
//      */
//     @Override
//     public void write(int b) {
//         this.count++;
//     }
// 
//     /**
//      * Does nothing - output to <code>/dev/null</code>.
//      * @param b The bytes to write
//      * @throws IOException never
//      */
//     @Override
//     public void write(byte[] b) throws IOException {
//         if (b != null) {
//         	this.count += b.length;
//         }
//     }
//     
//     public long getCount() {
//     	return this.count;
//     }
// 
// }


import java.io.IOException;
import java.util.Date;
import org.junit.Assert;
import org.junit.Test;
import com.linuxense.javadbf.mocks.NullOutputStream;
	public void testFieldsLengthSameAsHeaders() throws DBFException {
		NullOutputStream output = new NullOutputStream();
		DBFWriter writer = null;
		try {
			writer = new DBFWriter(output);
			writer.addRecord(new Object[] { 1, "John Smith", 1000.10, new Date() });
		}
		finally {
			DBFUtils.close(writer);
		}
	}

	private DBFField[] generateFields() {
		DBFField[] fields = new DBFField[5];

		fields[0] = new DBFField();
		fields[0].setName("emp_code");
		fields[0].setType(DBFDataType.NUMERIC);
		fields[0].setLength(10);
		fields[0].setDecimalCount(0);

		fields[1] = new DBFField();
		fields[1].setName("emp_name");
		fields[1].setType(DBFDataType.CHARACTER);
		fields[1].setLength(60);

		fields[2] = new DBFField();
		fields[2].setName("salary");
		fields[2].setType(DBFDataType.FLOATING_POINT);
		fields[2].setLength(12);
// Path: src/test/java/com/linuxense/javadbf/mocks/NullOutputStream.java
// public class NullOutputStream extends OutputStream {
//     
// 	private long count = 0;
// 	
// 
//     /**
//      * Constructor
//      */
//     public NullOutputStream() {
//         super();
//     }
//     /**
//      * Does nothing - output to <code>/dev/null</code>.
//      * @param b The bytes to write
//      * @param off The start offset
//      * @param len The number of bytes to write
//      */
//     @Override
//     public void write(byte[] b, int off, int len) {
//         this.count+= len;
//     }
// 
//     /**
//      * Does nothing - output to <code>/dev/null</code>.
//      * @param b The byte to write
//      */
//     @Override
//     public void write(int b) {
//         this.count++;
//     }
// 
//     /**
//      * Does nothing - output to <code>/dev/null</code>.
//      * @param b The bytes to write
//      * @throws IOException never
//      */
//     @Override
//     public void write(byte[] b) throws IOException {
//         if (b != null) {
//         	this.count += b.length;
//         }
//     }
//     
//     public long getCount() {
//     	return this.count;
//     }
// 
// }


// Path: src/test/java/com/linuxense/javadbf/DBFWriterStreamTest.java
import java.io.IOException;
import java.util.Date;
import org.junit.Assert;
import org.junit.Test;
import com.linuxense.javadbf.mocks.NullOutputStream;

	public void testFieldsLengthSameAsHeaders() throws DBFException {
		NullOutputStream output = new NullOutputStream();
		DBFWriter writer = null;
		try {
			writer = new DBFWriter(output);
			writer.addRecord(new Object[] { 1, "John Smith", 1000.10, new Date() });
		}
		finally {
			DBFUtils.close(writer);
		}
	}

	private DBFField[] generateFields() {
		DBFField[] fields = new DBFField[5];

		fields[0] = new DBFField();
		fields[0].setName("emp_code");
		fields[0].setType(DBFDataType.NUMERIC);
		fields[0].setLength(10);
		fields[0].setDecimalCount(0);

		fields[1] = new DBFField();
		fields[1].setName("emp_name");
		fields[1].setType(DBFDataType.CHARACTER);
		fields[1].setLength(60);

		fields[2] = new DBFField();
		fields[2].setName("salary");
		fields[2].setType(DBFDataType.FLOATING_POINT);
		fields[2].setLength(12);
		fields[2].setDecimalCount(2);