### Question:
GroupsPermissionsVm { public List<EntityPermissionsBlock> getBlocks() { return Collections.unmodifiableList(blocks); } GroupsPermissionsVm(@Nonnull WindowManager windowManager,
                               @Nonnull ComponentService componentService,
                               @Nonnull PermissionsService permissionsService,
                               @Nonnull SelectedEntity<Object> selectedEntity); List<EntityPermissionsBlock> getBlocks(); @Command void showGroupsDialog(@BindingParam("entity") Entity entity,
            @BindingParam("permission") JtalksPermission permission, @BindingParam("mode") String mode); static final String MANAGE_GROUPS_DIALOG_ZUL; }### Answer:
@Test(dataProvider = "dataProviderForGetBlocks") public void testGetBlocks(List<GeneralPermission> permissions, List<Component> components, GroupsPermissions<GeneralPermission> groupsPermissions) { when(componentService.getAll()).thenReturn(components); when(permissionsService.getPermissionsMapFor(any(Component.class))).thenReturn(groupsPermissions); viewModel = new GroupsPermissionsVm(windowManager, componentService,permissionsService, selectedEntity); List<EntityPermissionsBlock> blocks = viewModel.getBlocks(); verify(componentService, atLeastOnce()).getAll(); for (EntityPermissionsBlock block : blocks) { assertNotNull(block.getCaption()); assertTrue(components.contains(block.getEntity())); for (PermissionManagementBlock innerBlock : block.getBlocks()) { assertTrue(permissions.contains(innerBlock.getPermission())); } } }