/** @generated */
 private void insertData() {
   for (int i = 0; i < 3; i++) {
     RateProviderEntity entity = new RateProviderEntity();
     ProviderEntity product = new ProviderEntity();
     product.setName(generateRandom(String.class));
     em.persist(product);
     ClientEntity client = new ClientEntity();
     client.setName(generateRandom(String.class));
     em.persist(client);
     entity.setClient(client);
     entity.setProvider(product);
     entity.setRate((int) (Math.random() * 5) + 1);
     em.persist(entity);
     data.add(entity);
   }
 }
  /** 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());
  }