Ejemplo n.º 1
0
  @Test
  public void testUpdate() {

    String id = UUID.randomUUID().toString();
    PlayerDAO dao = new PlayerDAO();

    Player p = new Player();
    p.setId(id);
    p.setFirstName("Test");
    p.setLastName("Player");
    p.setNflTeam("Testers");
    p.setPosition("QB");
    p.setJerseyNumber(33);
    p.setHeight(80);
    p.setWeight(215);
    p.setBirthdate(new Date());
    p.setCollege("Penn State");

    assertTrue(dao.store(p));

    Player p2 = dao.getById(id);
    assertEquals(215, p2.getWeight());
    assertEquals(id, p2.getId());

    p2.setWeight(200);
    dao.store(p2);

    Player p3 = dao.getById(id);
    assertEquals(200, p3.getWeight());
    assertEquals(id, p3.getId());

    assertTrue(dao.remove(p3));
  }
Ejemplo n.º 2
0
  @Test
  public void testLoadById() {

    String id = "ac568889-d10d-4ccc-89a1-8e4233848086";
    PlayerDAO dao = new PlayerDAO();
    Player p = dao.getById(id);
    assertEquals(id, p.getId());
  }