/** Get rate by product and client test */
 @Test
 public void getRateByProviderClientTest() {
   RateProviderEntity entity = data.get(0);
   RateProviderEntity dto =
       rateProviderPersistence.findByProviderClient(
           entity.getProvider().getId(), entity.getClient().getId());
   Assert.assertNotNull(dto);
   Assert.assertEquals(entity.getRate(), dto.getRate());
 }
  /** Update rate product test */
  @Test
  public void updateRateTest() {

    RateProviderEntity entity = data.get(0);
    entity.setRate(0);
    entity = rateProviderPersistence.update(entity);

    RateProviderEntity resp = em.find(RateProviderEntity.class, entity.getId());
    Assert.assertNotNull(resp);
    Assert.assertEquals(entity.getRate(), resp.getRate());
  }
  /** Create rate product test */
  @Test
  public void createRateTest() {
    ProviderEntity pEntity = new ProviderEntity();
    pEntity.setId(data.get(0).getProvider().getId());
    ClientEntity cEntity = new ClientEntity();
    cEntity.setId(data.get(0).getClient().getId());
    RateProviderEntity rEntity = new RateProviderEntity();
    rEntity.setRate((int) (Math.random() * 5) + 1);
    rEntity.setClient(cEntity);
    rEntity.setProvider(pEntity);

    RateProviderEntity result = rateProviderPersistence.create(rEntity);
    Assert.assertNotNull(result);
    RateProviderEntity entity = em.find(RateProviderEntity.class, result.getId());

    Assert.assertEquals(result.getRate(), entity.getRate());
    Assert.assertEquals(result.getProvider().getId(), entity.getProvider().getId());
    Assert.assertEquals(result.getClient().getId(), entity.getClient().getId());
  }