/** This is a test which expands two paths with cardinalities 1-*-1-*-1 and 1-1-1-*-1. */
  public void testQueryJobsDeepExpandAndMultiple() {
    Query<Job> query =
        service
            .createJobQuery("/Job")
            .expand("jobParts/description/literals/language,jobPosting/name/literals/language");

    for (Job job : query) {
      String jobPostingPath = String.format("/Job(%d)/jobPosting", job.getId());

      JobPosting jobPosting = job.getJobPosting();

      Assert.assertNotNull("Should have fetched " + jobPostingPath, jobPosting);

      assertFullExpansionOfMultilingualField(jobPosting.getName(), jobPostingPath + "/name");

      if (job.getJobParts() != null) {

        for (JobPart jobPart : job.getJobParts()) {

          String jobPartDescriptionPath =
              String.format("/Job(%d)/jobParts(%d)/description", job.getId(), jobPart.getId());

          assertFullExpansionOfMultilingualField(jobPart.getDescription(), jobPartDescriptionPath);
        }
      }
    }
  }
  /**
   * This is a test which expands a path with cardinalities 1-1-*-1. At the same time, it tests for
   * correct reading of a property inside a complex property.
   */
  public void testQueryJobPostingsDeepExpandWithComplexProperty() {
    Query<JobPosting> jobPostingQuery =
        service
            .createJobPostingQuery("/JobPosting")
            .expand("name/literals/language")
            .filter("benefits/transportationOffered eq true")
            .top(10);

    for (JobPosting jobPosting : jobPostingQuery) {

      String jobPostingPath = String.format("/JobPostings(%d)", jobPosting.getId());

      assertFullExpansionOfMultilingualField(jobPosting.getName(), jobPostingPath + "/name");

      Benefits benefits = jobPosting.getBenefits();

      Assert.assertNotNull("jobPosting.benefits shouldn't be null", benefits);

      Assert.assertTrue(
          "jobPosting.benefits.transportationOffered should be true",
          benefits.getTransportationOffered());
    }
  }