@Test
public void should_add_bonita_api_extensions_resources_found_in_pages_widgets() throws Exception {

    setUpPageForResourcesTests();
    Set<String> authRules = new TreeSet<>();
    authRules.add("POST|bpm/process");
    HashMap<String, Variable> variables = new HashMap<>();
    variables.put("foo", anApiVariable("../API/extension/CA31/SQLToObject?filter=mine"));
    // Not supported platform side. Prefer use queryParam like ?id=4
    variables.put("bar", anApiVariable("../API/extension/user/4"));
    variables.put("aa", anApiVariable("../API/extension/group/list"));
    variables.put("session", anApiVariable("../API/extension/user/group/unusedid"));
    variables.put("ab", anApiVariable("http://localhost:8080/bonita/portal/API/extension/vehicule/voiture/roue?p=0&c=10&f=case_id={{caseId}}"));
    variables.put("user", anApiVariable("../API/identity/user/{{aaa}}/context"));
    variables.put("task", anApiVariable("../API/bpm/task/1/context"));
    variables.put("case", anApiVariable("../API/bpm/case{{dynamicQueries(true,0)}}"));
    variables.put("custom", anApiVariable("../API/extension/case{{dynamicQueries}}"));
    page.setVariables(variables);
    when(authRulesCollector.visit(page)).thenReturn(authRules);
    String properties = new String(pageResource.getResources(page.getId()).toString());
    assertThat(properties).contains("[GET|bpm/task, GET|identity/user, GET|bpm/case, GET|extension/group/list, GET|extension/vehicule/voiture/roue, GET|extension/user/4, GET|extension/user/group/unusedid, GET|extension/CA31/SQLToObject, GET|extension/case, POST|bpm/process]");
}