@Test public void writeBytes() throws Exception { BaseRoaringBitMap baseRoaringBitMap = mock(BaseRoaringBitMap.class, CALLS_REAL_METHODS); MutableRoaringBitmap mutableRoaringBitmap = mock(MutableRoaringBitmap.class); Whitebox.setInternalState(baseRoaringBitMap, "bitmap", mutableRoaringBitmap); OutputStream output = mock(OutputStream.class); DataOutputStream dataOutput = mock(DataOutputStream.class); whenNew(DataOutputStream.class).withArguments(output).thenReturn(dataOutput); when(baseRoaringBitMap.getType()).thenReturn(BitMapType.ROARING_MUTABLE); mockStatic(IoUtil.class); baseRoaringBitMap.writeBytes(output); verify(dataOutput).write(BitMapType.ROARING_MUTABLE.getHead()); verify(mutableRoaringBitmap).serialize(dataOutput); verifyStatic(IoUtil.class); IoUtil.close(dataOutput); }
@Override public void writeBytes(OutputStream output) { DataOutputStream dataOutput = new DataOutputStream(output); try { dataOutput.write(getType().getHead()); bitmap.serialize(dataOutput); } catch (IOException e) { SwiftLoggers.getLogger().error(e); } finally { IoUtil.close(dataOutput); } }
BaseRoaringBitMap extends AbstractBitMap { @Override public void writeBytes(OutputStream output) { DataOutputStream dataOutput = new DataOutputStream(output); try { dataOutput.write(getType().getHead()); bitmap.serialize(dataOutput); } catch (IOException e) { SwiftLoggers.getLogger().error(e); } finally { IoUtil.close(dataOutput); } } }
BaseRoaringBitMap extends AbstractBitMap { @Override public void writeBytes(OutputStream output) { DataOutputStream dataOutput = new DataOutputStream(output); try { dataOutput.write(getType().getHead()); bitmap.serialize(dataOutput); } catch (IOException e) { SwiftLoggers.getLogger().error(e); } finally { IoUtil.close(dataOutput); } } BaseRoaringBitMap(MutableRoaringBitmap bitmap); }
BaseRoaringBitMap extends AbstractBitMap { @Override public void writeBytes(OutputStream output) { DataOutputStream dataOutput = new DataOutputStream(output); try { dataOutput.write(getType().getHead()); bitmap.serialize(dataOutput); } catch (IOException e) { SwiftLoggers.getLogger().error(e); } finally { IoUtil.close(dataOutput); } } BaseRoaringBitMap(MutableRoaringBitmap bitmap); @Override boolean contains(int index); @Override boolean isEmpty(); @Override void traversal(final TraversalAction action); @Override boolean breakableTraversal(final BreakTraversalAction action); @Override IntIterator intIterator(); @Override int getCardinality(); @Override byte[] toBytes(); @Override void writeBytes(OutputStream output); @Override String toString(); }
BaseRoaringBitMap extends AbstractBitMap { @Override public void writeBytes(OutputStream output) { DataOutputStream dataOutput = new DataOutputStream(output); try { dataOutput.write(getType().getHead()); bitmap.serialize(dataOutput); } catch (IOException e) { SwiftLoggers.getLogger().error(e); } finally { IoUtil.close(dataOutput); } } BaseRoaringBitMap(MutableRoaringBitmap bitmap); @Override boolean contains(int index); @Override boolean isEmpty(); @Override void traversal(final TraversalAction action); @Override boolean breakableTraversal(final BreakTraversalAction action); @Override IntIterator intIterator(); @Override int getCardinality(); @Override byte[] toBytes(); @Override void writeBytes(OutputStream output); @Override String toString();  }