### Question:
EditGroupsForComponentPermissionVm extends TwoSideListWithFilterVm<Group> { @Command public void save() { List<Group> alreadyAddedGroups = getAlreadyAddedGroups(); @SuppressWarnings("unchecked") PermissionChanges accessChanges = new PermissionChanges(permissionForEntity.getPermission(), ListUtils.subtract(getStateAfterEdit(), alreadyAddedGroups), ListUtils.subtract(alreadyAddedGroups, getStateAfterEdit())); if (!accessChanges.isEmpty()) { if (permissionForEntity.isAllowed()) { permissionsService.changeGrants(component, accessChanges); } else { permissionsService.changeRestrictions(component, accessChanges); } } openGroupsPermissionsWindow(); } EditGroupsForComponentPermissionVm(@Nonnull WindowManager windowManager,
                                              @Nonnull PermissionsService permissionsService,
                                              @Nonnull GroupService groupService,
                                              @Nonnull SelectedEntity<Object> selectedEntity); @Command @NotifyChange({AVAIL_PROPERTY, EXIST_PROPERTY, AVAIL_SELECTED_PROPERTY, EXIST_SELECTED_PROPERTY}) void filterAvail(); @Command @NotifyChange({AVAIL_PROPERTY, EXIST_PROPERTY, AVAIL_SELECTED_PROPERTY, EXIST_SELECTED_PROPERTY}) void filterExist(); @Command void cancel(); @Command void save(); @Init void initVm(); @Override void updateVm(); static final String GROUPS_PERMISSIONS_ZUL; }### Answer:
@Test(dataProvider = "dataProvider") public void testSaveWithoutChanges(PermissionForEntity permissionForEntity, GroupsPermissions<GeneralPermission> groupsPermissions) throws NotFoundException { initTest(permissionForEntity, groupsPermissions); viewModel.save(); vefiryNothingChanges(); }
@Test(dataProvider = "dataProvider") public void testSaveWithChanges(PermissionForEntity permissionForEntity, GroupsPermissions<GeneralPermission> groupsPermissions) { initTest(permissionForEntity, groupsPermissions); viewModel.removeAll(); viewModel.save(); vefiryPermissionsChanged(permissionForEntity); verify(windowManager).open(anyString()); }