### Question:
BrandPortalAgentFilter implements AgentFilter { @SuppressWarnings("squid:S3776") protected List<Resource> getBrandPortalConfigs(Resource content) { if (content == null) { return Collections.emptyList(); } else if (JcrConstants.JCR_CONTENT.equals(content.getName())) { content = content.getParent(); } final List<Resource> resources = new ArrayList<Resource>(); final ResourceResolver resourceResolver = content.getResourceResolver(); do { ValueMap properties = content.getValueMap(); String[] configs = properties.get(PROP_MP_CONFIG, new String[]{}); if (ArrayUtils.isNotEmpty(configs)) { if (log.isDebugEnabled()) { log.debug("Resolved Brand Portal configs [ {}@{} -> {} ]", content.getPath(), PROP_MP_CONFIG, StringUtils.join(configs, ",")); } for (final String config : configs) { Resource r = resourceResolver.getResource(config + "/" + JcrConstants.JCR_CONTENT); if (r != null) { resources.add(r); } } break; } content = content.getParent(); } while (content != null); return resources; } BrandPortalAgentFilter(Resource content); boolean isIncluded(Agent agent);  }### Answer:
@Test public void getBrandPortalConfigs() throws Exception { final List<Resource> expected = new ArrayList<>(); expected.add(slingContext.resourceResolver().getResource(cloudServiceConfigPath + "/jcr:content")); final List<Resource> actual = filter.getBrandPortalConfigs(slingContext.resourceResolver().getResource(assetsFolderPath)); assertEquals(expected.size(), actual.size()); assertEquals(expected.get(0).getPath(), actual.get(0).getPath()); }
@Test public void mpConfigIsNotConfigured() { slingContext.create().resource(assetsFolderPathWithoutMpConfig, ImmutableMap.<String, Object>builder() .build()); final List<Resource> actual = filter.getBrandPortalConfigs(slingContext.resourceResolver().getResource(assetsFolderPathWithoutMpConfig)); assertEquals(0, actual.size()); }