File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 2121
2222public interface CopyFlagSet extends FlagSet <CopyFlags > {
2323
24- static CopyFlagSet EMPTY = CopyFlagSetImpl .EMPTY ;
24+ CopyFlagSet EMPTY = CopyFlagSetImpl .EMPTY ;
2525
2626 static CopyFlagSet empty () {
2727 return CopyFlagSetImpl .EMPTY ;
Original file line number Diff line number Diff line change @@ -159,6 +159,39 @@ void testAllFlags() {
159159 }
160160 }
161161
162+ /**
163+ * Test as an enum instance rather than a {@link FlagSet}
164+ */
165+ @ Test
166+ void testAsFlag () {
167+ final T flag = getFirst ();
168+ assertThat (flag .size ())
169+ .isEqualTo (1 );
170+ assertThat (flag .getFlags ())
171+ .hasSize (1 );
172+ final T flag2 = flag .getFlags ().iterator ().next ();
173+ assertThat (flag2 == flag )
174+ .isTrue ();
175+ assertThat (flag .getMask ())
176+ .isEqualTo (MaskedFlag .mask (flag ));
177+ assertThat (flag .isEmpty ())
178+ .isFalse ();
179+ assertThat (flag .toString ())
180+ .isNotNull ();
181+ assertThat (flag .isSet (flag ))
182+ .isTrue ();
183+ assertThat (flag .isSet (flag2 ))
184+ .isTrue ();
185+ assertThat (flag .isSet (null ))
186+ .isFalse ();
187+ final List <T > allFlags = getAllFlags ();
188+ if (allFlags .size () > 1 ) {
189+ T secondFlag = allFlags .get (1 );
190+ assertThat (flag .isSet (secondFlag ))
191+ .isFalse ();
192+ }
193+ }
194+
162195 private T [] toArray (final int cnt ) {
163196 //noinspection unchecked
164197 return (T []) Array .newInstance (getFlagType (), cnt );
You can’t perform that action at this time.
0 commit comments