AppSetupServiceMybatisImpl extends ViewService { public long getDefaultViewId() { return defaultViewId; } AppSetupServiceMybatisImpl(); boolean hasPermissionToAlterView(final View view, final User user); List<View> getViews(int page, int pageSize); View getViewWithConf(long viewId); View getViewWithConfByUuId(String uuId); View getViewWithConfByOldId(long oldId); View getViewWithConf(String viewName); List<View> getViewsForUser(long userId); long addView(View view); void updateAccessFlag(View view); void deleteViewById(final long id); void deleteViewByUserId(long userId); void resetUsersDefaultViews(long userId); void updateView(View view); void updateViewUsage(View view); void updatePublishedView(final View view); void updateBundleSettingsForView(final long viewId, final Bundle bundle); long getDefaultViewId(); long getDefaultViewId(final User user); long getSystemDefaultViewId(Collection<Role> roles); @SuppressWarnings("unchecked") @Override List<Long> getSystemDefaultViewIds(); boolean isSystemDefaultView(final long id); long getDefaultViewIdForRole(final String roleName);  }
@Test public void testGetDefaultViewId() throws Exception { final User guest = new GuestUser(); assertEquals("User with no roles should end up using the value configure in 'view.default'", 5, service.getDefaultViewId(guest)); guest.addRole(1, "Guest"); assertEquals("User with Guest role should end up using the value configure in 'view.default.Guest'", 4, service.getDefaultViewId(guest)); final User user = new User(); user.addRole(2, "User"); assertEquals("User with User role should end up using the value configure in 'view.default.User'", 3, service.getDefaultViewId(user)); user.addRole(3, "Admin"); assertEquals("User with Admin role should end up using the value configure in 'view.default.Admin'", 2, service.getDefaultViewId(user)); }