Exemple #1
0
  @Test
  public void recruitersCanDisplayJobsTheyPosted() {
    setupActors();
    JobRepository jobRepository = new JobRepository();

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

    JobPostings jobPostings = recruiter.getPostedJobs().from(jobRepository);

    JobPostingsDisplayer postingsDisplayer = Mockito.mock(JobPostingsDisplayer.class);
    jobPostings.displayTo(postingsDisplayer);
    Mockito.verify(postingsDisplayer)
        .displayJobPostings(
            Matchers.argThat(
                new SetOfThreeJobPostings(developerPosting, architectPosting, programmerPosting)));
  }
Exemple #2
0
 @Test
 public void recruiterCanPostJob() {
   Recruiter recruiter = Recruiter.named("George");
   Job developerJob = ATSJob.titled("Developer");
   JobRepository jobRepository = Mockito.mock(JobRepository.class);
   recruiter.post(developerJob).to(jobRepository);
   JobPosting posting = new JobPosting(recruiter, developerJob);
   Mockito.verify(jobRepository).add(posting);
 }
Exemple #3
0
  @Test
  public void recruitersCanListJobsTheyPosted() {
    setupActors();
    JobRepository jobRepository = new JobRepository();

    recruiter.post(developerJob).to(jobRepository);
    recruiter.post(architectJob).to(jobRepository);

    JobPostings jobPostings = recruiter.getPostedJobs().from(jobRepository);

    assertTrue(jobPostings.contains(developerJob));
    assertTrue(jobPostings.contains(architectJob));
    assertFalse(jobPostings.contains(programmerJob));
  }
Exemple #4
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)));
  }
Exemple #5
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)));
  }