/**
  * runs all "pre" filters. These filters are run before routing to the orgin.
  *
  * @throws ZuulException
  */
 public void preRoute() throws ZuulException {
   try {
     runFilters("pre");
   } catch (Throwable e) {
     if (e instanceof ZuulException) {
       throw (ZuulException) e;
     }
     throw new ZuulException(e, 500, "UNCAUGHT_EXCEPTION_IN_PRE_FILTER_" + e.getClass().getName());
   }
 }
  @Test
  public void testRequestedClaimsSelectNoScope() throws Exception {
    // Given
    Bindings variables =
        testBindings(
            asSet("openid"), Collections.singletonMap("given_name", asSet("fred", "george")));
    when(identity.getAttribute("cn")).thenReturn(asSet("Joe Bloggs"));

    // When/Then
    try {
      scriptEvaluator.evaluateScript(script, variables);
    } catch (Throwable e) {
      Throwable last = null;
      while (last != e) {
        if (e.getClass().equals(RuntimeException.class)) {
          break;
        }
        last = e;
        e = e.getCause();
      }
      assertThat(e.getMessage())
          .isEqualTo("No selection logic for given_name defined. Values: [george, fred]");
    }
  }