@Test(expected = RightTypeException.class) public void shouldNotGroupRightsOfDifferentTypes() throws Exception, RightTypeException { Right right1 = Right.ofType(RightType.ORDER_FULFILLMENT); Right right2 = Right.ofType(RightType.SUPERVISION); Role.group(right1, right2); }
public static Role group(Right... rights) throws RightTypeException { List<Right> rightsList = new ArrayList<>(asList(rights)); if (checkRightTypesMatch(rightsList)) { return new Role(rightsList); } else { throw new RightTypeException(); } }
Role { public static Role group(Right... rights) throws RightTypeException { List<Right> rightsList = new ArrayList<>(asList(rights)); if (checkRightTypesMatch(rightsList)) { return new Role(rightsList); } else { throw new RightTypeException(); } } }
Role { public static Role group(Right... rights) throws RightTypeException { List<Right> rightsList = new ArrayList<>(asList(rights)); if (checkRightTypesMatch(rightsList)) { return new Role(rightsList); } else { throw new RightTypeException(); } } private  Role(List<Right> rights); }
Role { public static Role group(Right... rights) throws RightTypeException { List<Right> rightsList = new ArrayList<>(asList(rights)); if (checkRightTypesMatch(rightsList)) { return new Role(rightsList); } else { throw new RightTypeException(); } } private  Role(List<Right> rights); static Role group(Right... rights); List<Right> getRights(); RightType getRightType(); void add(Right... additionalRights); boolean contains(Right right); }
Role { public static Role group(Right... rights) throws RightTypeException { List<Right> rightsList = new ArrayList<>(asList(rights)); if (checkRightTypesMatch(rightsList)) { return new Role(rightsList); } else { throw new RightTypeException(); } } private  Role(List<Right> rights); static Role group(Right... rights); List<Right> getRights(); RightType getRightType(); void add(Right... additionalRights); boolean contains(Right right);  }