@Test public void testTrackRequest() { tracker.trackRequest(req1); assertThat(tracker.currentRequests().iterator().next().request(), is(req1.toString())); }
public void trackRequest(LiveHttpRequest request, Supplier<String> state) { if (currentRequests.containsKey(request.id())) { currentRequests.get(request.id()).setCurrentThread(Thread.currentThread()); } else { currentRequests.put(request.id(), new CurrentRequest(request, state)); } }
CurrentRequestTracker implements RequestTracker { public void trackRequest(LiveHttpRequest request, Supplier<String> state) { if (currentRequests.containsKey(request.id())) { currentRequests.get(request.id()).setCurrentThread(Thread.currentThread()); } else { currentRequests.put(request.id(), new CurrentRequest(request, state)); } } }
CurrentRequestTracker implements RequestTracker { public void trackRequest(LiveHttpRequest request, Supplier<String> state) { if (currentRequests.containsKey(request.id())) { currentRequests.get(request.id()).setCurrentThread(Thread.currentThread()); } else { currentRequests.put(request.id(), new CurrentRequest(request, state)); } }  }
CurrentRequestTracker implements RequestTracker { public void trackRequest(LiveHttpRequest request, Supplier<String> state) { if (currentRequests.containsKey(request.id())) { currentRequests.get(request.id()).setCurrentThread(Thread.currentThread()); } else { currentRequests.put(request.id(), new CurrentRequest(request, state)); } }  void trackRequest(LiveHttpRequest request, Supplier<String> state); void trackRequest(LiveHttpRequest request); void markRequestAsSent(LiveHttpRequest request); void endTrack(LiveHttpRequest request); Collection<CurrentRequest> currentRequests(); }
CurrentRequestTracker implements RequestTracker { public void trackRequest(LiveHttpRequest request, Supplier<String> state) { if (currentRequests.containsKey(request.id())) { currentRequests.get(request.id()).setCurrentThread(Thread.currentThread()); } else { currentRequests.put(request.id(), new CurrentRequest(request, state)); } }  void trackRequest(LiveHttpRequest request, Supplier<String> state); void trackRequest(LiveHttpRequest request); void markRequestAsSent(LiveHttpRequest request); void endTrack(LiveHttpRequest request); Collection<CurrentRequest> currentRequests(); static final CurrentRequestTracker INSTANCE; }