@Test
  public void testEqualsObject() {

    assertTrue(
        "Test Address Order 1 and 2 should equal each other",
        TestDepartmentObject1.equals(TestDepartmentObject2));
    assertFalse(
        "Test Address Order 1 and 3 should not equal each other - Id",
        TestDepartmentObject1.equals(TestDepartmentObject3));
    assertFalse(
        "Test Address Order 1 and 4 should not equal each other - Name",
        TestDepartmentObject1.equals(TestDepartmentObject4));
    assertFalse(
        "Test Address Order 1 and 5 should not equal each other - Chair",
        TestDepartmentObject1.equals(TestDepartmentObject5));
  }
Example #2
0
  public void departTest() {
    Department department1 = depDAO.getDepartment(1);
    Department department2 = depDAO.getDepartment(2);
    Department department3 = depDAO.getDepartment(3);
    Worker worker1 = new Worker("jaku", 18);
    worker1.setWorkerPassword("111111");
    worker1.setDepartment(department1);
    worker1.setWorkerLevel(1);

    Worker worker2 = new Worker("balen", 28);
    worker2.setWorkerPassword("111111");
    worker2.setDepartment(department2);
    worker2.setWorkerLevel(2);

    Worker worker3 = new Worker("admin", 38);
    worker3.setWorkerPassword("111111");
    worker3.setDepartment(department3);
    worker3.setWorkerLevel(3);

    department1.addWorker(worker1);
    department2.addWorker(worker2);
    department3.addWorker(worker3);
    depDAO.saveDepart(department1);
    depDAO.saveDepart(department2);
    depDAO.saveDepart(department3);
  }
  public static Company createCompany() {

    // Create company
    Company sampleCompany = new Company();
    sampleCompany.setName("ACME Corporation");

    // Create all employees
    Employee craig = new Employee();
    craig.setName("Craig");
    craig.setAddress("Redmond");
    craig.setSalary(123456);
    Employee erik = new Employee();
    erik.setName("Erik");
    erik.setAddress("Utrecht");
    erik.setSalary(12345);
    Employee ralf = new Employee();
    ralf.setName("Ralf");
    ralf.setAddress("Koblenz");
    ralf.setSalary(1234);
    Employee ray = new Employee();
    ray.setName("Ray");
    ray.setAddress("Redmond");
    ray.setSalary(234567);
    Employee klaus = new Employee();
    klaus.setName("Klaus");
    klaus.setAddress("Boston");
    klaus.setSalary(23456);
    Employee karl = new Employee();
    karl.setName("Karl");
    karl.setAddress("Riga");
    karl.setSalary(2345);
    Employee joe = new Employee();
    joe.setName("Joe");
    joe.setAddress("Wifi City");
    joe.setSalary(2344);

    // Create research department
    Department research = new Department();
    research.setManager(craig);
    research.setName("Research");
    research.getEmployees().add(erik);
    research.getEmployees().add(ralf);
    sampleCompany.getDepts().add(research);

    // Create development department
    Department development = new Department();
    development.setManager(ray);
    development.setName("Development");
    sampleCompany.getDepts().add(development);

    // Create sub-department dev1
    Department dev1 = new Department();
    dev1.setName("Dev1");
    dev1.setManager(klaus);
    development.getSubdepts().add(dev1);

    // Create sub-department dev11
    Department dev11 = new Department();
    dev11.setName("Dev1.1");
    dev11.setManager(karl);
    dev11.getEmployees().add(joe);
    dev1.getSubdepts().add(dev11);

    return sampleCompany;
  }