@Test
  public void testAppliesTo() {
    assertNull(
        SAMLUtil.getFirstElement(((RequestSecurityToken) req.getXMLObject()), AppliesTo.class));

    req.setAppliesTo("appliesto");
    RequestSecurityToken rst = (RequestSecurityToken) req.getXMLObject();

    AppliesTo appliesTo = SAMLUtil.getFirstElement(rst, AppliesTo.class);
    assertNotNull(appliesTo);
    EndpointReference epr = (EndpointReference) appliesTo.getUnknownXMLObjects().get(0);
    assertEquals("appliesto", epr.getAddress().getValue());
  }