### Question:
RoaringMutableBitMap extends RoaringImmutableBitMap implements MutableBitMap { public static MutableBitMap ofStream(InputStream input) { MutableRoaringBitmap another = new MutableRoaringBitmap(); DataInputStream dis = new DataInputStream(input); try { another.deserialize(dis); return of(another); } catch (IOException e) { SwiftLoggers.getLogger().error(e); return of(); } finally { IoUtil.close(dis); } } private  RoaringMutableBitMap(MutableRoaringBitmap bitmap); static MutableBitMap of(); static MutableBitMap ofBytes(byte[] bytes); static MutableBitMap ofStream(InputStream input); @Override void or(ImmutableBitMap index); @Override void and(ImmutableBitMap index); @Override void not(int bound); @Override void andNot(ImmutableBitMap index); @Override void add(int index); @Override void remove(int index); @Override ImmutableBitMap clone(); @Override BitMapType getType();  }### Answer:
@Test public void ofStream() throws Exception { MutableRoaringBitmap mutableRoaringBitmap = mock(MutableRoaringBitmap.class, RETURNS_DEEP_STUBS); whenNew(MutableRoaringBitmap.class).withNoArguments().thenReturn(mutableRoaringBitmap); DataInputStream dataInputStream = mock(DataInputStream.class); InputStream input = mock(InputStream.class); whenNew(DataInputStream.class).withArguments(input).thenReturn(dataInputStream); MutableBitMap mutableBitMap = mock(MutableBitMap.class); spy(RoaringMutableBitMap.class); doReturn(mutableBitMap).when(RoaringMutableBitMap.class); RoaringMutableBitMap.of(mutableRoaringBitmap); mockStatic(IoUtil.class); assertEquals(mutableBitMap, RoaringMutableBitMap.ofStream(input)); verify(mutableRoaringBitmap).deserialize(dataInputStream); doThrow(new IOException()).when(mutableRoaringBitmap).deserialize(dataInputStream); doReturn(mutableBitMap).when(RoaringMutableBitMap.class); RoaringMutableBitMap.of(); assertEquals(mutableBitMap, RoaringMutableBitMap.ofStream(input)); verifyStatic(IoUtil.class, times(2)); IoUtil.close(dataInputStream); }