### Question:
ExpansionHandler implements RuleChangesObserver { protected boolean isBackendExpand(String uri) { return ruleFeaturesProvider.isFeatureRequest(EXPAND_ON_BACKEND, uri); } ExpansionHandler(Vertx vertx, final ResourceStorage storage, HttpClient httpClient, final Map<String, Object> properties, String serverRoot, final String rulesPath); @Override void rulesChanged(List<Rule> rules); int getMaxExpansionLevelSoft(); int getMaxExpansionLevelHard(); int getMaxSubRequestCount(); boolean isExpansionRequest(HttpServerRequest request); boolean isZipRequest(HttpServerRequest request); void handleExpansionRecursion(final HttpServerRequest request); void handleZipRecursion(final HttpServerRequest request); boolean isCollection(String target); static final String SERIOUS_EXCEPTION; static final String EXPAND_PARAM; static final String ZIP_PARAM; static final String MAX_EXPANSION_LEVEL_SOFT_PROPERTY; static final String MAX_EXPANSION_LEVEL_HARD_PROPERTY; static final String MAX_SUBREQUEST_PROPERTY; }### Answer:
@Test public void testIsBackendExpand(TestContext context) { expansionHandler = new ExpansionHandler(vertx, storage, httpClient, new HashMap<>(), ROOT, RULES_ROOT); context.assertFalse(expansionHandler.isBackendExpand("/some/request/uri"), "uri should not be a backend expand since no routing rules have been defined yet"); List<Rule> rules = new ArrayList<>(); Rule rule1 = new Rule(); rule1.setUrlPattern("/test/rules/rule/backendExpand"); rule1.setExpandOnBackend(true); rules.add(rule1); Rule rule2 = new Rule(); rule2.setUrlPattern("/test/rules/rule/notBackendExpand"); rule2.setExpandOnBackend(false); rules.add(rule2); expansionHandler.rulesChanged(rules); context.assertTrue(expansionHandler.isBackendExpand("/test/rules/rule/backendExpand"), "uri should be a backend expand"); context.assertFalse(expansionHandler.isBackendExpand("/test/rules/rule/notBackendExpand"), "uri should not be a backend expand"); context.assertFalse(expansionHandler.isBackendExpand("/some/other/request/uri"), "uri should not be a backend expand"); }