@Test
  public void verifySaveAttributeReleasePolicyAllowedAttrRulesAndFilter() {
    final RegexRegisteredService r = new RegexRegisteredService();
    r.setName("testSaveAttributeReleasePolicyAllowedAttrRulesAndFilter");
    r.setServiceId("testId");
    r.setTheme("testtheme");
    r.setEvaluationOrder(1000);
    r.setAccessStrategy(new DefaultRegisteredServiceAccessStrategy(true, false));
    r.setProxyPolicy(new RegexMatchingRegisteredServiceProxyPolicy("https://.+"));
    r.setRequiredHandlers(new HashSet<>(Lists.newArrayList("h1", "h2")));

    final ReturnAllowedAttributeReleasePolicy policy = new ReturnAllowedAttributeReleasePolicy();
    policy.setAllowedAttributes(Lists.newArrayList("1", "2", "3"));
    r.setAttributeReleasePolicy(policy);
    r.getAttributeReleasePolicy()
        .setAttributeFilter(new RegisteredServiceRegexAttributeFilter("\\w+"));

    final RegisteredService r2 = this.dao.save(r);
    final RegisteredService r3 = this.dao.findServiceById(r2.getId());

    assertEquals(r, r2);
    assertEquals(r2, r3);
    assertNotNull(r3.getAttributeReleasePolicy());
    assertEquals(r2.getAttributeReleasePolicy(), r3.getAttributeReleasePolicy());
  }
  @Test
  public void verifySaveAttributeReleasePolicyAllowedAttrRules() {
    final RegexRegisteredService r = new RegexRegisteredService();
    r.setName("testSaveAttributeReleasePolicyAllowedAttrRules");
    r.setServiceId("testId");

    final ReturnAllowedAttributeReleasePolicy policy = new ReturnAllowedAttributeReleasePolicy();
    policy.setAllowedAttributes(Lists.newArrayList("1", "2", "3"));
    r.setAttributeReleasePolicy(policy);

    final RegisteredService r2 = this.dao.save(r);
    final RegisteredService r3 = this.dao.findServiceById(r2.getId());

    assertEquals(r, r2);
    assertEquals(r2, r3);
    assertNotNull(r3.getAttributeReleasePolicy());
    assertEquals(r2.getAttributeReleasePolicy(), r3.getAttributeReleasePolicy());
  }