### Question:
CGT { public boolean getNextRecord() throws IOException { while (entriesRead < entryCount) { retrieveEntry(); } boolean result; int id = readByte(); if (id == RECORD_CONTENT_MULTI) { entriesRead = 0; entryCount = rawReadUInt16(); result = true; } else { result = false; } return result; } CGT(); Entry retrieveEntry(); boolean atEOF(); void close(); boolean isRecordComplete(); int getEntryCount(); int getEntriesRead(); String getHeader(); boolean getNextRecord(); void open(File file); void open(InputStream input); boolean retrieveBoolean(); int retrieveByte(); int retrieveInteger(); String retrieveString(); static final int RECORD_CONTENT_MULTI; }### Answer:
@Test public void testGetNextRecord() throws Exception { CGT cgt = new CGT(); cgt.open(new ByteArrayInputStream(new byte[] {})); assertFalse(cgt.getNextRecord()); cgt.open(new ByteArrayInputStream(toByteArray(HEADER))); assertFalse(cgt.getNextRecord()); cgt.open(new ByteArrayInputStream(toByteArray(HEADER, SAMPLE_BOOLEANS, SAMPLE_BYTES, SAMPLE_STRINGS))); assertTrue("booleans", cgt.getNextRecord()); assertTrue("bytes", cgt.getNextRecord()); assertTrue("strings", cgt.getNextRecord()); assertFalse("nothing more", cgt.getNextRecord()); }