@Test
public void testRequestInterceptorChainCreation() throws Exception {

  ClientRequestInterceptor root =
      super.getRouterClientRMService().createRequestInterceptorChain();
  int index = 0;
  while (root != null) {
    // The current pipeline is:
    // PassThroughClientRequestInterceptor - index = 0
    // PassThroughClientRequestInterceptor - index = 1
    // PassThroughClientRequestInterceptor - index = 2
    // MockClientRequestInterceptor - index = 3
    switch (index) {
    case 0: // Fall to the next case
    case 1: // Fall to the next case
    case 2:
      // If index is equal to 0,1 or 2 we fall in this check
      Assert.assertEquals(PassThroughClientRequestInterceptor.class.getName(),
          root.getClass().getName());
      break;
    case 3:
      Assert.assertEquals(MockClientRequestInterceptor.class.getName(),
          root.getClass().getName());
      break;
    default:
      Assert.fail();
    }
    root = root.getNextInterceptor();
    index++;
  }
  Assert.assertEquals("The number of interceptors in chain does not match", 4,
      index);
}