Ejemplo n.º 1
0
  @Test(dependsOnMethods = "updateAdministrator")
  public void delete() {

    administratorCrudService = (EmployeeLogCrudService) ctx.getBean("administratorCrudService");
    EmployeeLog administrator = administratorCrudService.findById(id);
    administratorCrudService.remove(administrator);
    EmployeeLog delete = administratorCrudService.findById(id);
    assertNull(delete);
  }
Ejemplo n.º 2
0
  @Test(dependsOnMethods = "createAdministrator")
  public void updateAdministrator() {

    administratorCrudService = (EmployeeLogCrudService) ctx.getBean("administratorCrudService");
    EmployeeLog administrator = administratorCrudService.findById(id);
    administrator.setLoginTime("10:00");
    administratorCrudService.merge(administrator);
    EmployeeLog update = administratorCrudService.findById(id);
    assertEquals(update.getLoginTime(), "10:00");
  }
Ejemplo n.º 3
0
  @Test
  public void createAdministrator() {

    administratorCrudService = (EmployeeLogCrudService) ctx.getBean("administratorCrudService");

    HashMap<String, String> details = new HashMap<String, String>();
    details.put("loginTime", "9:00");
    details.put("logoutTime", "18:00");

    Contact contact = ContactFactory.getContact("*****@*****.**", "0742367309", "0216789990");
    Demography demo = DemographyFactory.getDemography("Female", "black", new Date(12 / 9 / 1992));
    Employee emp =
        new EmployeeFactory.Builder(123)
            .FirstName("Nolu")
            .LastName("Tyokozo")
            .JobId("Programmer")
            .Contact(contact)
            .Demography(demo)
            .build();
    List employee = new ArrayList<Employee>();
    employee.add(emp);

    EmployeeLog admin =
        EmployeeLogFactory.getAdministator(new Date(13 / 9 / 2013), details, employee);

    administratorCrudService.persist(admin);

    id = admin.getId();

    assertNotNull(admin);
  }
Ejemplo n.º 4
0
  @Test(dependsOnMethods = "createAdministrator")
  public void readAdministrator() {

    administratorCrudService = (EmployeeLogCrudService) ctx.getBean("administratorCrudService");

    EmployeeLog administrator = administratorCrudService.findById(id);
    assertNotNull(administrator);
  }