@Test public void successCaseTest() { Mockito.when(appRepository.findByClientId(clientId)).thenReturn(app); clientIdInterceptorService.validate(api1.getId(), Location.HEADER); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), this.ctx.getResponseStatusCode()); }
public void validate(Long apiId, Location location) { RequestContext context = RequestContext.getCurrentContext(); String clientId; if (Location.HEADER.equals(location)) { clientId = context.getZuulRequestHeaders().get(CLIENT_ID); if (clientId == null) clientId = context.getRequest().getHeader(CLIENT_ID); } else clientId = context.getRequest().getParameter(CLIENT_ID); this.validateClientId(apiId, clientId); }
ClientIdInterceptorService { public void validate(Long apiId, Location location) { RequestContext context = RequestContext.getCurrentContext(); String clientId; if (Location.HEADER.equals(location)) { clientId = context.getZuulRequestHeaders().get(CLIENT_ID); if (clientId == null) clientId = context.getRequest().getHeader(CLIENT_ID); } else clientId = context.getRequest().getParameter(CLIENT_ID); this.validateClientId(apiId, clientId); } }
ClientIdInterceptorService { public void validate(Long apiId, Location location) { RequestContext context = RequestContext.getCurrentContext(); String clientId; if (Location.HEADER.equals(location)) { clientId = context.getZuulRequestHeaders().get(CLIENT_ID); if (clientId == null) clientId = context.getRequest().getHeader(CLIENT_ID); } else clientId = context.getRequest().getParameter(CLIENT_ID); this.validateClientId(apiId, clientId); }  }
ClientIdInterceptorService { public void validate(Long apiId, Location location) { RequestContext context = RequestContext.getCurrentContext(); String clientId; if (Location.HEADER.equals(location)) { clientId = context.getZuulRequestHeaders().get(CLIENT_ID); if (clientId == null) clientId = context.getRequest().getHeader(CLIENT_ID); } else clientId = context.getRequest().getParameter(CLIENT_ID); this.validateClientId(apiId, clientId); }  void validate(Long apiId, Location location); }
ClientIdInterceptorService { public void validate(Long apiId, Location location) { RequestContext context = RequestContext.getCurrentContext(); String clientId; if (Location.HEADER.equals(location)) { clientId = context.getZuulRequestHeaders().get(CLIENT_ID); if (clientId == null) clientId = context.getRequest().getHeader(CLIENT_ID); } else clientId = context.getRequest().getParameter(CLIENT_ID); this.validateClientId(apiId, clientId); }  void validate(Long apiId, Location location);  }