### Question:
FieldSelector { public static FieldSelector fromBitmap(int bitmap) { if (bitmap < 0 || bitmap >= (1 << Field.values().length)) { throw new IllegalArgumentException("Bitmap value is out of bounds"); } return new FieldSelector(bitmap); } private  FieldSelector(int bitmap); int getBitmap(); void ifSelectedRun(Field field, Runnable runnable); boolean isSelected(Field field); FieldSelector withoutField(Field field); static FieldSelector fromBitmap(int bitmap); static FieldSelector fromFields(List<String> fields); static final FieldSelector DEFAULT_FIELDS; static final FieldSelector NO_FIELDS; static final FieldSelector ALL_FIELDS; }### Answer:
@Test public void testInvalidBitmapLowerRange() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> FieldSelector.fromBitmap(-1)) .withMessageContaining("Bitmap value is out of bounds"); }
@Test public void testInvalidBitmapUpperRange() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> FieldSelector.fromBitmap(1024)) .withMessageContaining("Bitmap value is out of bounds"); }
@Test public void testFromBitmap() { FieldSelector fields = FieldSelector.fromBitmap(42); assertThat(fields.getBitmap()).isEqualTo(42); }