### Question:
WikiPermission extends Permission implements Serializable { protected static int createMask( String actions ) { if ( actions == null || actions.length() == 0 ) { throw new IllegalArgumentException( "Actions cannot be blank or null" ); } int mask = 0; String[] actionList = actions.split( "," ); for( int i = 0; i < actionList.length; i++ ) { String action = actionList[i]; if ( action.equalsIgnoreCase( CREATE_GROUPS_ACTION ) ) { mask |= CREATE_GROUPS_MASK; } else if ( action.equalsIgnoreCase( CREATE_PAGES_ACTION ) ) { mask |= CREATE_PAGES_MASK; } else if ( action.equalsIgnoreCase( LOGIN_ACTION ) ) { mask |= LOGIN_MASK; } else if ( action.equalsIgnoreCase( EDIT_PREFERENCES_ACTION ) ) { mask |= EDIT_PREFERENCES_MASK; } else if ( action.equalsIgnoreCase( EDIT_PROFILE_ACTION ) ) { mask |= EDIT_PROFILE_MASK; } else { throw new IllegalArgumentException( "Unrecognized action: " + action ); } } return mask; } WikiPermission( String wiki, String actions ); boolean equals( Object obj ); String getActions(); String getWiki(); int hashCode(); boolean implies( Permission permission ); PermissionCollection newPermissionCollection(); String toString(); static final String CREATE_GROUPS_ACTION; static final String CREATE_PAGES_ACTION; static final String LOGIN_ACTION; static final String EDIT_PREFERENCES_ACTION; static final String EDIT_PROFILE_ACTION; static final String WILDCARD; static final WikiPermission CREATE_GROUPS; static final WikiPermission CREATE_PAGES; static final WikiPermission LOGIN; static final WikiPermission EDIT_PREFERENCES; static final WikiPermission EDIT_PROFILE; }### Answer:
@Test public void testCreateMask() { Assertions.assertEquals(1, WikiPermission.createMask("createGroups")); Assertions.assertEquals(2, WikiPermission.createMask("createPages")); Assertions.assertEquals(3, WikiPermission.createMask("createGroups,createPages")); Assertions.assertEquals(4, WikiPermission.createMask("editPreferences")); Assertions.assertEquals(5, WikiPermission.createMask("createGroups,editPreferences")); Assertions.assertEquals(6, WikiPermission.createMask("createPages,editPreferences")); Assertions.assertEquals(7, WikiPermission.createMask("createGroups,createPages,editPreferences")); Assertions.assertEquals(8, WikiPermission.createMask("editProfile")); Assertions.assertEquals(9, WikiPermission.createMask("createGroups,editProfile")); Assertions.assertEquals(16, WikiPermission.createMask("login")); Assertions.assertEquals(24, WikiPermission.createMask("login,editProfile")); }