@Test public void testAddUserToFreeGroup() throws Exception { User user = new User("Free User"); UserGroup.addUserToFreeGroup(user); assertFalse(UserGroup.isPaid(user)); }
public static void addUserToFreeGroup(final User user) throws IllegalArgumentException { if (paidGroup.contains(user)) { throw new IllegalArgumentException("User all ready member of paid group."); } else { if (!freeGroup.contains(user)) { freeGroup.add(user); } } }
UserGroup { public static void addUserToFreeGroup(final User user) throws IllegalArgumentException { if (paidGroup.contains(user)) { throw new IllegalArgumentException("User all ready member of paid group."); } else { if (!freeGroup.contains(user)) { freeGroup.add(user); } } } }
UserGroup { public static void addUserToFreeGroup(final User user) throws IllegalArgumentException { if (paidGroup.contains(user)) { throw new IllegalArgumentException("User all ready member of paid group."); } else { if (!freeGroup.contains(user)) { freeGroup.add(user); } } }  }
UserGroup { public static void addUserToFreeGroup(final User user) throws IllegalArgumentException { if (paidGroup.contains(user)) { throw new IllegalArgumentException("User all ready member of paid group."); } else { if (!freeGroup.contains(user)) { freeGroup.add(user); } } }  static void addUserToFreeGroup(final User user); static void addUserToPaidGroup(final User user); static boolean isPaid(User user); }
UserGroup { public static void addUserToFreeGroup(final User user) throws IllegalArgumentException { if (paidGroup.contains(user)) { throw new IllegalArgumentException("User all ready member of paid group."); } else { if (!freeGroup.contains(user)) { freeGroup.add(user); } } }  static void addUserToFreeGroup(final User user); static void addUserToPaidGroup(final User user); static boolean isPaid(User user);  }