### Question:
EditGroupsVm extends AbstractDialogVm { @GlobalCommand(EDIT_GROUPS) @NotifyChange({SHOW_DIALOG, GROUPS, USER_TO_EDIT, CHOSEN, NOT_CHOSEN}) public void editGroups() throws NotFoundException { userToEdit = usersVm.getSelectedUser(); init(); showDialog(); } EditGroupsVm(UsersVm usersVm, UserService userService, GroupService groupService); @GlobalCommand(EDIT_GROUPS) @NotifyChange({SHOW_DIALOG, GROUPS, USER_TO_EDIT, CHOSEN, NOT_CHOSEN}) void editGroups(); @GlobalCommand(FILTER_GROUPS) @NotifyChange(GROUPS) void filterGroups(); @GlobalCommand(SAVE_CHANGES) @NotifyChange(SHOW_DIALOG) void saveChanges(); boolean isChosen(); void setChosen(boolean chosen); boolean isNotChosen(); void setNotChosen(boolean notChosen); List<GroupBooleanPair> getGroups(); User getUserToEdit(); List<GroupBooleanPair> getGroupsToShow();  }### Answer:
@Test public void editGroupsTest() throws NotFoundException { int expectedSizeGroupsToShow = allGroups.size(); vm.editGroups(); Assert.assertTrue(vm.isChosen()); Assert.assertTrue(vm.isNotChosen()); Assert.assertTrue(vm.isShowDialog()); Assert.assertEquals(expectedSizeGroupsToShow, vm.getGroups().size()); for (GroupBooleanPair groupPair : vm.getGroups()) { Assert.assertEquals(userGroups.contains(groupPair.getGroup()), groupPair.isEnable()); } Assert.assertEquals(expectedSizeGroupsToShow, vm.getGroupsToShow().size()); for (GroupBooleanPair groupPair : vm.getGroupsToShow()) { Assert.assertTrue(allGroups.contains(groupPair.getGroup())); } }