### Question:
HprofReader { public void next() throws IOException { if (readCount == 0) { readHprofFileHeader(); } else { readRecord(); } readCount++; nextTag = readByte(in); } HprofReader(@Nonnull InputStream in, @Nonnull HprofProcessor processor); boolean hasNext(); void next(); @Nonnull InputStream getInputStream(); @Nonnull ClassDefinition readLoadClassRecord(); @Nonnull HprofString readStringRecord(int recordLength, int timestamp); StackFrame readStackFrame();  }### Answer:
@Test public void readHeader() throws IOException { final AtomicBoolean called = new AtomicBoolean(false); HprofProcessor processor = new DiscardProcessor() { @Override public void onHeader(@Nonnull String text, int idSize, int timeHigh, int timeLow) throws IOException { called.set(true); assertEquals(HEADER_TEXT, text); assertEquals(TIME_HIGH, timeHigh); assertEquals(TIME_LOW, timeLow); } }; HprofReader reader = new HprofReader(new ByteArrayInputStream(buffer.toByteArray()), processor); reader.next(); assertTrue(called.get()); }