### Question:
CppAstParser { public void readStream(final Store store, final InputStream stream) { BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); try { while(reader.ready()) { parseLine(store, reader.readLine()); } } catch (IOException e) { LOGGER.warn("Exception while reading AST file, could not read all lines; reason: "+e); } }  void readStream(final Store store, final InputStream stream);  }### Answer:
@Test public void parseEmptyStream() throws Exception { ByteArrayInputStream is = new ByteArrayInputStream(new byte[0]); cppAstParser.readStream(store, is); verifyZeroInteractions(store); }
@Test public void parseCxxRecordDefinition() throws Exception { ByteArrayInputStream is = new ByteArrayInputStream( "|-CXXRecordDecl 0x2b24038 <line:12:1, line:36:1> line:12:7 class Alice definition " .getBytes()); ClassDescriptor mockClassDescriptor = mock(ClassDescriptor.class); when(store.create(ClassDescriptor.class)).thenReturn(mockClassDescriptor); cppAstParser.readStream(store, is); verify(store).create(ClassDescriptor.class); verify(mockClassDescriptor).setName("Alice"); }