### Question:
DataSourceService extends BaseService { public Map<String, Object> authedDatasource(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (!isAdmin(loginUser)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } List<DataSource> authedDatasourceList = dataSourceMapper.queryAuthedDatasource(userId); result.put(Constants.DATA_LIST, authedDatasourceList); putMsg(result, Status.SUCCESS); return result; }  Map<String, Object> createDataSource(User loginUser, String name, String desc, DbType type, String parameter); Map<String, Object> updateDataSource(int id, User loginUser, String name, String desc, DbType type, String parameter); Map<String, Object> queryDataSource(int id); Map<String, Object> queryDataSourceListPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize); Map<String, Object> queryDataSourceList(User loginUser, Integer type); Result verifyDataSourceName(String name); boolean checkConnection(DbType type, String parameter); boolean connectionTest(int id); String buildParameter(DbType type, String host,
                                 String port, String database, String principal, String userName,
                                 String password, DbConnectType connectType, String other); @Transactional(rollbackFor = RuntimeException.class) Result delete(User loginUser, int datasourceId); Map<String, Object> unauthDatasource(User loginUser, Integer userId); Map<String, Object> authedDatasource(User loginUser, Integer userId); static final String NAME; static final String NOTE; static final String TYPE; static final String HOST; static final String PORT; static final String PRINCIPAL; static final String DATABASE; static final String USER_NAME; static final String OTHER; }### Answer:
@Test public void authedDatasourceTest() { User loginUser = getAdminUser(); int userId = -1; Map<String, Object> noOperationPerm = dataSourceService.authedDatasource(loginUser, userId); Assert.assertEquals(Status.USER_NO_OPERATION_PERM, noOperationPerm.get(Constants.STATUS)); loginUser.setUserType(UserType.ADMIN_USER); Map<String, Object> success = dataSourceService.authedDatasource(loginUser, userId); Assert.assertEquals(Status.SUCCESS, success.get(Constants.STATUS)); }