### Question:
IdBitMap extends RangeBitmap { public static ImmutableBitMap of(int id) { return new IdBitMap(id); } private  IdBitMap(int id); int getId(); static ImmutableBitMap of(int id); @Override ImmutableBitMap getAnd(ImmutableBitMap index); @Override ImmutableBitMap getOr(ImmutableBitMap index); @Override ImmutableBitMap clone(); @Override BitMapType getType(); @Override byte[] toBytes(); @Override String toString();  }### Answer:
@Test public void testGetAndNot() { MutableBitMap m = getMutableBitMap(); int[] a = prepare(m); int id = r.nextInt(BOUND); ImmutableBitMap im = IdBitMap.of(id); ImmutableBitMap andNot = im.getAndNot(m); for (int i = 0; i < a.length; i++) { if (i != id && andNot.contains(i)) { fail(); } } if (m.contains(id) == andNot.contains(id)) { fail(); } }
@Test public void testGetNot() { int rowCount = r.nextInt(BOUND); int id = r.nextInt(rowCount); ImmutableBitMap im = IdBitMap.of(id); ImmutableBitMap not = im.getNot(rowCount); for (int i = 0; i < rowCount; i++) { if (i != id && !not.contains(i)) { fail(); } } if (not.contains(id)) { fail(); } }
@Test public void writeBytes() throws Exception { OutputStream output = mock(OutputStream.class); mockStatic(IoUtil.class); IdBitMap.of(1).writeBytes(output); ByteBuffer buf = ByteBuffer.allocate(5) .order(ByteOrder.LITTLE_ENDIAN) .put(BitMapType.ID.getHead()) .putInt(1); verify(output).write(buf.array()); doThrow(new IOException()).when(output).write(any(byte[].class)); IdBitMap.of(1).writeBytes(output); verifyStatic(IoUtil.class, times(2)); IoUtil.close(output); }