@Test public void testInvalidFieldName() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> FieldSelector.fromFields(singletonList("KALLE"))) .withMessageContaining("No enum") .withMessageContaining("KALLE"); }
public static FieldSelector fromFields(List<String> fields) { int bitmap = fields.stream() .map(String::toUpperCase) .map(Field::valueOf) .mapToInt(Field::getBit) .distinct() .sum(); return new FieldSelector(bitmap); }
FieldSelector { public static FieldSelector fromFields(List<String> fields) { int bitmap = fields.stream() .map(String::toUpperCase) .map(Field::valueOf) .mapToInt(Field::getBit) .distinct() .sum(); return new FieldSelector(bitmap); } }
FieldSelector { public static FieldSelector fromFields(List<String> fields) { int bitmap = fields.stream() .map(String::toUpperCase) .map(Field::valueOf) .mapToInt(Field::getBit) .distinct() .sum(); return new FieldSelector(bitmap); } private  FieldSelector(int bitmap); }
FieldSelector { public static FieldSelector fromFields(List<String> fields) { int bitmap = fields.stream() .map(String::toUpperCase) .map(Field::valueOf) .mapToInt(Field::getBit) .distinct() .sum(); 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); }
FieldSelector { public static FieldSelector fromFields(List<String> fields) { int bitmap = fields.stream() .map(String::toUpperCase) .map(Field::valueOf) .mapToInt(Field::getBit) .distinct() .sum(); 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; }