コード例 #1
0
ファイル: JobArchiveTest.java プロジェクト: jbandyo/code-man
 @Test
 public void testInstance() {
   assertNotNull("GetInstnace must return the object", savedList);
   assertEquals(
       "Newly constructed JobSeekerSavedLists instance should have zero size",
       savedList.getNumberOfLists(),
       0);
 }
コード例 #2
0
ファイル: JobArchiveTest.java プロジェクト: jbandyo/code-man
 @Test
 public void testGetJobList() {
   PostedJobs jobs = savedList.getJobs(seeker1);
   assertNull("GetJobs must return null for a job seeker who did not save job", jobs);
   savedList.addJob(seeker1, postedJob1);
   savedList.addJob(seeker1, postedJob2);
   savedList.addJob(seeker2, postedJob3);
   jobs = savedList.getJobs(seeker1);
   assertNotNull("GetJobs must not return null when the repository is not empty", jobs);
   assertEquals(
       "GetJobs for a job seeker must return all jobs saved by the job seeker",
       jobs.getCount(),
       2);
   assertTrue("GetJobs must contain posted job", jobs.contains(postedJob1));
   assertTrue("GetJobs must contain posted job", jobs.contains(postedJob2));
   jobs = savedList.getJobs(seeker2);
   assertEquals(
       "GetJobs for a job seeker must return all jobs saved by the job seeker",
       jobs.getCount(),
       1);
   assertTrue("GetJobs must contain posted job", jobs.contains(postedJob3));
 }
コード例 #3
0
ファイル: JobArchiveTest.java プロジェクト: jbandyo/code-man
  @Test
  public void testAddJob() {
    boolean result;
    result = savedList.addJob(seeker1, postedJob1);
    assertTrue("AddJob must return true when successful", result);
    assertEquals(
        "List count should go up by one after a new jobseeker's addJob",
        savedList.getNumberOfLists(),
        1); // assuming single-threaded testing
    // same job by same jobseeker - can not be saved again
    result = savedList.addJob(seeker1, postedJob1);
    assertFalse("Same job can not be saved more than once", result);
    // different jobseeker can save the same job
    result = savedList.addJob(seeker2, postedJob1);
    assertTrue("AddJob must return true when successful", result);

    savedList.deleteAllLists();
    assertEquals("List count should be zero after deleteAllLists", savedList.getNumberOfLists(), 0);
  }
コード例 #4
0
ファイル: JobArchiveTest.java プロジェクト: jbandyo/code-man
 @Test(expected = IllegalArgumentException.class)
 public void testSaveJobWithNullArgument() {
   savedList.addJob(null, null);
   savedList.addJob(seeker1, null);
   savedList.addJob(null, postedJob1);
 }
コード例 #5
0
ファイル: JobArchiveTest.java プロジェクト: jbandyo/code-man
 @After
 public void tearDown() throws Exception {
   savedList.deleteAllLists();
 }