@Override
    public BitMask setAll(BitMask mask) {
        if (mask instanceof LongBitMask) {
            this.mask |= ((LongBitMask) mask).asLong();
        } else if (mask instanceof AllSetBitMask) {
            return AllSetBitMask.get();
        } else if (mask instanceof AllSetButLastBitMask) {
            return isSet(0) ? AllSetBitMask.get() : AllSetButLastBitMask.get();
        } else if (mask instanceof OpenBitSet) {
            return mask.setAll(this);
        } else if (mask instanceof EmptyButLastBitMask) {
            return set(0);
        }
        return this;
    }
@Test
  public void testSetAll() {
      assertThat(new LongBitMask().setAll(new LongBitMask()).toString()).isEqualTo("0");
      assertThat(new LongBitMask().setAll(AllSetBitMask.get()).toString()).isEqualTo("-1");
      assertThat(new LongBitMask().setAll(AllSetButLastBitMask.get()).toString()).isEqualTo("9223372036854775807");
      assertThat(new LongBitMask(1).setAll(AllSetButLastBitMask.get()).toString()).isEqualTo("-1");
      assertThat(new LongBitMask().setAll(new OpenBitSet()).toString()).isEqualTo("0");
      assertThat(new LongBitMask().setAll(EmptyButLastBitMask.get()).toString()).isEqualTo("1");
      assertThat(new LongBitMask().setAll(EmptyBitMask.get()).toString()).isEqualTo("0");
  }