test_class.file: restx-core/src/test/java/restx/specs/RestxSpecRepositoryTest.java
test_class.identifier: RestxSpecRepositoryTest
test_case.body: @Test
      public void should_find_specs_for_request() throws Exception {
          RestxSpecRepository resource = getRestxSpecRepository();
  
          WhenHttpRequest when1;
          WhenHttpRequest when2;
          WhenHttpRequest when3;
          ImmutableMap<String, RestxSpec> allSpecs = ImmutableMap.of(
                  "cases/test/test.spec.yaml", spec("should say hello on path",
                              when1 = when("GET", "/messages/xavier")),
                  "cases/test/test2.spec.yaml", spec("should say hello w/ query param",
                              when2 = when("GET", "/messages?who=xavier")),
                  "cases/test/test3.spec.yaml", spec("should say hello w/ other query param",
                              when3 = when("GET", "/messages?who=jules"))
          );
  
          assertThat(resource.findWhensMatchingRequest(allSpecs, request("GET", "/messages/xavier")))
                  .isNotEmpty().containsExactly(when1);
          assertThat(resource.findWhensMatchingRequest(allSpecs, request("GET", "/messages?who=xavier")))
                  .isNotEmpty().containsExactly(when2);
          assertThat(resource.findWhensMatchingRequest(allSpecs, request("GET", "/messages?who=xavier&test=anything")))
                  .isNotEmpty().containsExactly(when2);
          assertThat(resource.findWhensMatchingRequest(allSpecs, request("GET", "/messages?who=jules")))
                  .isNotEmpty().containsExactly(when3);
      }
test_case.class_method_signature: RestxSpecRepositoryTest.should_find_specs_for_request()
test_case.full_signature: @Test public void should_find_specs_for_request()
test_case.identifier: should_find_specs_for_request
test_case.invocations: getRestxSpecRepository of spec when spec when spec when containsExactly isNotEmpty assertThat findWhensMatchingRequest request containsExactly isNotEmpty assertThat findWhensMatchingRequest request containsExactly isNotEmpty assertThat findWhensMatchingRequest request containsExactly isNotEmpty assertThat findWhensMatchingRequest request
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_find_specs_for_request()
focal_class.declarator: logger = LoggerFactory.getLogger(RestxSpecRepository.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(RestxSpecRepository.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: allSpecs
focal_class.modifier: private
focal_class.original_string: private ImmutableMap<String, RestxSpec> allSpecs;
focal_class.type: ImmutableMap<String, RestxSpec>
focal_class.var_name: allSpecs
focal_class.declarator: specLoader
focal_class.modifier: private
focal_class.original_string: private RestxSpecLoader specLoader;
focal_class.type: RestxSpecLoader
focal_class.var_name: specLoader
focal_class.file: restx-core/src/main/java/restx/specs/RestxSpecRepository.java
focal_class.identifier: RestxSpecRepository
focal_class.class_method_signature: RestxSpecRepository.RestxSpecRepository(RestxSpecLoader specLoader)
focal_class.full_signature: public  RestxSpecRepository(RestxSpecLoader specLoader)
focal_class.identifier: RestxSpecRepository
focal_class.modifiers: public
focal_class.parameters: (RestxSpecLoader specLoader)
focal_class.signature:  RestxSpecRepository(RestxSpecLoader specLoader)
focal_class.class_method_signature: RestxSpecRepository.findAll()
focal_class.full_signature: public Iterable<String> findAll()
focal_class.identifier: findAll
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Iterable<String>
focal_class.signature: Iterable<String> findAll()
focal_class.class_method_signature: RestxSpecRepository.findSpecById(String id)
focal_class.full_signature: public Optional<RestxSpec> findSpecById(String id)
focal_class.identifier: findSpecById
focal_class.modifiers: public
focal_class.parameters: (String id)
focal_class.return: Optional<RestxSpec>
focal_class.signature: Optional<RestxSpec> findSpecById(String id)
focal_class.class_method_signature: RestxSpecRepository.findSpecsByOperation(String httpMethod, String path)
focal_class.full_signature: public Iterable<String> findSpecsByOperation(String httpMethod, String path)
focal_class.identifier: findSpecsByOperation
focal_class.modifiers: public
focal_class.parameters: (String httpMethod, String path)
focal_class.return: Iterable<String>
focal_class.signature: Iterable<String> findSpecsByOperation(String httpMethod, String path)
focal_class.class_method_signature: RestxSpecRepository.findSpecsByRequest(RestxRequest request)
focal_class.full_signature: public Iterable<WhenHttpRequest> findSpecsByRequest(RestxRequest request)
focal_class.identifier: findSpecsByRequest
focal_class.modifiers: public
focal_class.parameters: (RestxRequest request)
focal_class.return: Iterable<WhenHttpRequest>
focal_class.signature: Iterable<WhenHttpRequest> findSpecsByRequest(RestxRequest request)
focal_class.class_method_signature: RestxSpecRepository.findAllSpecs()
focal_class.full_signature: synchronized ImmutableMap<String, RestxSpec> findAllSpecs()
focal_class.identifier: findAllSpecs
focal_class.modifiers: synchronized
focal_class.parameters: ()
focal_class.return: ImmutableMap<String, RestxSpec>
focal_class.signature: ImmutableMap<String, RestxSpec> findAllSpecs()
focal_class.class_method_signature: RestxSpecRepository.buildSpecsMap(boolean searchInSources)
focal_class.full_signature: protected Map<String, RestxSpec> buildSpecsMap(boolean searchInSources)
focal_class.identifier: buildSpecsMap
focal_class.modifiers: protected
focal_class.parameters: (boolean searchInSources)
focal_class.return: Map<String, RestxSpec>
focal_class.signature: Map<String, RestxSpec> buildSpecsMap(boolean searchInSources)
focal_class.class_method_signature: RestxSpecRepository.filterSpecsByOperation(ImmutableMap<String, RestxSpec> allSpecs,
                                                      String httpMethod, String path)
focal_class.full_signature:  Iterable<String> filterSpecsByOperation(ImmutableMap<String, RestxSpec> allSpecs,
                                                      String httpMethod, String path)
focal_class.identifier: filterSpecsByOperation
focal_class.parameters: (ImmutableMap<String, RestxSpec> allSpecs,
                                                      String httpMethod, String path)
focal_class.return: Iterable<String>
focal_class.signature: Iterable<String> filterSpecsByOperation(ImmutableMap<String, RestxSpec> allSpecs,
                                                      String httpMethod, String path)
focal_class.class_method_signature: RestxSpecRepository.findWhensMatchingRequest(ImmutableMap<String, RestxSpec> allSpecs, RestxRequest restxRequest)
focal_class.full_signature:  Iterable<WhenHttpRequest> findWhensMatchingRequest(ImmutableMap<String, RestxSpec> allSpecs, RestxRequest restxRequest)
focal_class.identifier: findWhensMatchingRequest
focal_class.parameters: (ImmutableMap<String, RestxSpec> allSpecs, RestxRequest restxRequest)
focal_class.return: Iterable<WhenHttpRequest>
focal_class.signature: Iterable<WhenHttpRequest> findWhensMatchingRequest(ImmutableMap<String, RestxSpec> allSpecs, RestxRequest restxRequest)
focal_method.body: Iterable<WhenHttpRequest> findWhensMatchingRequest(ImmutableMap<String, RestxSpec> allSpecs, RestxRequest restxRequest) {
          Collection<WhenHttpRequest> matchingRequestsSpecs = Lists.newArrayList();
          for (Map.Entry<String, RestxSpec> spec : allSpecs.entrySet()) {
              for (When when : spec.getValue().getWhens()) {
                  if (when instanceof WhenHttpRequest) {
                      WhenHttpRequest request = (WhenHttpRequest) when;
                      String requestPath = request.getPath();
                      if (!requestPath.startsWith("/")) {
                          requestPath = "/" + requestPath;
                      }
                      StdRequest stdRequest = StdRequest.builder()
                              .setBaseUri("http://restx.io") // baseUri is required but we won't use it
                              .setHttpMethod(request.getMethod()).setFullPath(requestPath).build();
  
                      if (restxRequest.getHttpMethod().equals(stdRequest.getHttpMethod())
                              && restxRequest.getRestxPath().equals(stdRequest.getRestxPath())) {
                          MapDifference<String, ImmutableList<String>> difference =
                                  Maps.difference(restxRequest.getQueryParams(), stdRequest.getQueryParams());
                          if (difference.entriesOnlyOnRight().isEmpty()
                                  && difference.entriesDiffering().isEmpty()) {
                              matchingRequestsSpecs.add(request);
                              break;
                          }
                      }
                  }
              }
          }
          return matchingRequestsSpecs;
      }
focal_method.class_method_signature: RestxSpecRepository.findWhensMatchingRequest(ImmutableMap<String, RestxSpec> allSpecs, RestxRequest restxRequest)
focal_method.full_signature:  Iterable<WhenHttpRequest> findWhensMatchingRequest(ImmutableMap<String, RestxSpec> allSpecs, RestxRequest restxRequest)
focal_method.identifier: findWhensMatchingRequest
focal_method.invocations: newArrayList entrySet getWhens getValue getPath startsWith build setFullPath setHttpMethod setBaseUri builder getMethod equals getHttpMethod getHttpMethod equals getRestxPath getRestxPath difference getQueryParams getQueryParams isEmpty entriesOnlyOnRight isEmpty entriesDiffering add
focal_method.parameters: (ImmutableMap<String, RestxSpec> allSpecs, RestxRequest restxRequest)
focal_method.return: Iterable<WhenHttpRequest>
focal_method.signature: Iterable<WhenHttpRequest> findWhensMatchingRequest(ImmutableMap<String, RestxSpec> allSpecs, RestxRequest restxRequest)