Пример #1
0
  @Test
  public void createCarritoTest() {
    CarritoDTO dto = new CarritoDTO();
    dto.setName(generateRandom(String.class));
    dto.setClientId(generateRandom(Long.class));

    CarritoDTO result = carritoPersistence.createCarrito(dto);

    Assert.assertNotNull(result);

    CarritoEntity entity = em.find(CarritoEntity.class, result.getId());

    Assert.assertEquals(dto.getName(), entity.getName());
    Assert.assertEquals(dto.getClientId(), entity.getClientId());
  }
Пример #2
0
  @Test
  public void updateCarritoTest() {
    CarritoEntity entity = data.get(0);

    CarritoDTO dto = new CarritoDTO();
    dto.setId(entity.getId());
    dto.setName(generateRandom(String.class));
    dto.setClientId(generateRandom(Long.class));

    carritoPersistence.updateCarrito(dto);

    CarritoEntity resp = em.find(CarritoEntity.class, entity.getId());

    Assert.assertEquals(dto.getName(), resp.getName());
    Assert.assertEquals(dto.getClientId(), resp.getClientId());
  }