### Question:
BaseAuthorityServiceImpl extends BaseServiceImpl<BaseAuthorityMapper, BaseAuthority> implements BaseAuthorityService { @Override public void clearInvalidApi(String serviceId, Collection<String> codes) { if (StringUtils.isBlank(serviceId)) { return; } List<String> invalidApiIds = baseApiService.listObjs(new QueryWrapper<BaseApi>().select("api_id").eq("service_id", serviceId).notIn(codes!=null&&!codes.isEmpty(),"api_code", codes), e -> e.toString()); if (invalidApiIds != null) { invalidApiIds.remove("1"); invalidApiIds.remove("2"); if (invalidApiIds.isEmpty()) { return; } List<String> invalidAuthorityIds = listObjs(new QueryWrapper<BaseAuthority>().select("authority_id").in("api_id", invalidApiIds), e -> e.toString()); if (invalidAuthorityIds != null && !invalidAuthorityIds.isEmpty()) { baseAuthorityAppMapper.delete(new QueryWrapper<BaseAuthorityApp>().in("authority_id", invalidAuthorityIds)); baseAuthorityActionMapper.delete(new QueryWrapper<BaseAuthorityAction>().in("authority_id", invalidAuthorityIds)); baseAuthorityRoleMapper.delete(new QueryWrapper<BaseAuthorityRole>().in("authority_id", invalidAuthorityIds)); baseAuthorityUserMapper.delete(new QueryWrapper<BaseAuthorityUser>().in("authority_id", invalidAuthorityIds)); this.removeByIds(invalidAuthorityIds); baseApiService.removeByIds(invalidApiIds); } } }  @Override List<AuthorityResource> findAuthorityResource(); @Override List<AuthorityMenu> findAuthorityMenu(Integer status); @Override List<AuthorityApi> findAuthorityApi(String serviceId); @Override List<BaseAuthorityAction> findAuthorityAction(Long actionId); @Override BaseAuthority saveOrUpdateAuthority(Long resourceId, ResourceType resourceType); @Override void removeAuthority(Long resourceId, ResourceType resourceType); @Override BaseAuthority getAuthority(Long resourceId, ResourceType resourceType); @Override Boolean isGranted(Long resourceId, ResourceType resourceType); @Override void removeAuthorityApp(String appId); @Override void removeAuthorityAction(Long actionId); @Override void addAuthorityRole(Long roleId, Date expireTime, String... authorityIds); @Override void addAuthorityUser(Long userId, Date expireTime, String... authorityIds); @CacheEvict(value = {"apps"}, key = "'client:'+#appId") @Override void addAuthorityApp(String appId, Date expireTime, String... authorityIds); @CacheEvict(value = {"apps"}, key = "'client:'+#appId") @Override void addAuthorityApp(String appId, Date expireTime, String authorityId); @Override void addAuthorityAction(Long actionId, String... authorityIds); @Override List<OpenAuthority> findAuthorityByApp(String appId); @Override List<OpenAuthority> findAuthorityByRole(Long roleId); @Override List<OpenAuthority> findAuthorityByType(String type); @Override List<OpenAuthority> findAuthorityByUser(Long userId, Boolean root); @Override List<AuthorityMenu> findAuthorityMenuByUser(Long userId, Boolean root); @Override Boolean isGrantedByRoleIds(String authorityId, Long... roleIds); @Override void clearInvalidApi(String serviceId, Collection<String> codes);  }### Answer:
@Test public void clearInvalidApi() { String[] serviceIds = { "serviceId", "serviceId2" }; for (String serviceId : serviceIds) { baseAuthorityService.clearInvalidApi(serviceId, Collections.emptyList()); } }