@Test
public void testClear() throws IOException
{

	try {
		Record record = new Record(new IntValue(42));

		record.write(this.out);
		Assert.assertEquals(42, record.getField(0, IntValue.class).getValue());

		record.setField(0, new IntValue(23));
		record.write(this.out);
		Assert.assertEquals(23, record.getField(0, IntValue.class).getValue());

		record.clear();
		Assert.assertEquals(0, record.getNumFields());

		Record record2 = new Record(new IntValue(42));
		record2.read(in);
		Assert.assertEquals(42, record2.getField(0, IntValue.class).getValue());
		record2.read(in);
		Assert.assertEquals(23, record2.getField(0, IntValue.class).getValue());
	} catch (Throwable t) {
		Assert.fail("Test failed due to an exception: " + t.getMessage());
	}
}