示例#1
0
  @Test
  public void recruitersCanSeeJobseekersByJobAndDate() {
    setupRepositories();
    setupActors();
    JobPosting developerPosting = recruiter.post(developerJob).to(jobRepository);
    JobPosting architectPosting = recruiter.post(architectJob).to(jobRepository);

    TimeServer timeServerOne = Mockito.mock(TimeServer.class);
    TimeServer timeServerTwo = Mockito.mock(TimeServer.class);
    Date dayOne = null;
    Date dayTwo = null;
    try {
      dayOne = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse("2013-05-01 12:30:00");
      dayTwo = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse("2013-07-04 12:30:00");
    } catch (ParseException e) {
      fail();
    }
    Mockito.when(timeServerOne.getCurrentTime()).thenReturn(dayOne);
    Mockito.when(timeServerTwo.getCurrentTime()).thenReturn(dayTwo);
    ApplicationProcessor appProcessorOne = new ApplicationProcessor(appRepo, timeServerOne);
    ApplicationProcessor appProcessorTwo = new ApplicationProcessor(appRepo, timeServerTwo);

    boolean applyStatus;

    applyStatus = jobseekerTom.applyFor(developerPosting).to(appProcessorOne);
    assertTrue(applyStatus);
    applyStatus = jobseekerHarry.applyFor(developerPosting).to(appProcessorOne);
    assertTrue(applyStatus);
    applyStatus = jobseekerTom.applyFor(architectPosting).to(appProcessorTwo);
    assertTrue(applyStatus);
    applyStatus = jobseekerDick.applyFor(architectPosting).to(appProcessorTwo);
    assertTrue(applyStatus);

    Applications appsOnDayOne = recruiter.getApplications().filterBy(dayOne).from(appRepo);

    ApplicationsDisplayer appsDisplayer = Mockito.mock(ApplicationsDisplayer.class);
    appsOnDayOne.displayTo(appsDisplayer);
    Mockito.verify(appsDisplayer)
        .displayApplications(Mockito.argThat(new SetOfTwoAppsWithDates(dayOne)));

    Applications appsOnDayTwoForArchitect =
        recruiter.getApplications().filterBy(architectPosting).filterBy(dayTwo).from(appRepo);

    appsDisplayer = Mockito.mock(ApplicationsDisplayer.class);
    appsOnDayTwoForArchitect.displayTo(appsDisplayer);
    Mockito.verify(appsDisplayer)
        .displayApplications(
            Mockito.argThat(new SetOfTwoAppsWithJobPostingsAndDates(dayTwo, architectPosting)));
  }
示例#2
0
  @Test
  public void recruitersCanSeeJobseekersByJob() {
    setupActors();
    setupRepositories();

    JobPosting developerPosting = recruiter.post(developerJob).to(jobRepository);
    JobPosting architectPosting = recruiter.post(architectJob).to(jobRepository);

    boolean applyStatus;
    applyStatus = jobseekerTom.applyFor(developerPosting).to(appProcessor);
    assertTrue(applyStatus);
    applyStatus = jobseekerHarry.applyFor(developerPosting).to(appProcessor);
    assertTrue(applyStatus);
    applyStatus = jobseekerTom.applyFor(architectPosting).to(appProcessor);
    assertTrue(applyStatus);
    applyStatus = jobseekerDick.applyFor(architectPosting).to(appProcessor);
    assertTrue(applyStatus);

    Applications developerApps =
        recruiter.getApplications().filterBy(developerPosting).from(appRepo);

    ApplicationsDisplayer appsDisplayer = Mockito.mock(ApplicationsDisplayer.class);
    developerApps.displayTo(appsDisplayer);
    Mockito.verify(appsDisplayer)
        .displayApplications(
            Mockito.argThat(new SetOfTwoAppsWithJobSeekers(jobseekerTom, jobseekerHarry)));

    Applications architectApps =
        recruiter.getApplications().filterBy(architectPosting).from(appRepo);

    appsDisplayer = Mockito.mock(ApplicationsDisplayer.class);
    architectApps.displayTo(appsDisplayer);
    Mockito.verify(appsDisplayer)
        .displayApplications(
            Mockito.argThat(new SetOfTwoAppsWithJobSeekers(jobseekerTom, jobseekerDick)));
  }