Exemplo n.º 1
0
  @Test
  public void testCheckForWorkers() throws Exception {

    assertTrue(
        crs.checkForWorkers()); // you have two workers, the minimum is one, you should be okay

    crs.removeLastWorker(); // remove a worker
    assertTrue(crs.checkForWorkers()); // should still work
    Person w = crs.removeLastWorker();
    assertTrue(!crs.checkForWorkers()); // should still work
    crs.addWorker(w);
    assertTrue(crs.checkForWorkers()); // should still work
  }
Exemplo n.º 2
0
  @Test
  public void testWorkerSize() throws Exception {

    assertEquals(crs.getNumberOfWorkers(), 2);
    Person w = crs.removeLastWorker();
    assertEquals(crs.getNumberOfWorkers(), 1);
    crs.addWorker(w);
    assertEquals(crs.getNumberOfWorkers(), 2);
  }