Hello, I get the following error:
junit.framework.AssertionFailedError
at TestGestors.provaIncrementarPreuDistribuidor1(TestGestors.java:189)
and this other one
junit.framework.AssertionFailedError
at TestGestors.provaIncrementarPreu(TestGestors.java:183)
I do not know what it means or understand how to avoid it.
I put the code parts that give the Show Failed:
Line 189
@Test
public void provaIncrementarPreuDistribuidor1() throws GestorException{
gestorArticleExtern.incrementarPreu(1, 70);
assertTrue(comparaLlistesArticles(gestorArticle.obtenirArticles(),totsIncrementatsEl70pcDist1));
}
public void incrementarPreu(int codiDistribuidor, float percentantge) {
//TODO completar el metode
Query q = em.createQuery("SELECT a FROM Article a");
List<Article> articles = q.getResultList();
for (Article a : articles) {
a.setPreu(a.getPreu() * percentantge);
em.merge(a);
}
}
line 183
public void provaIncrementarPreu() throws GestorException{
gestorArticle.incrementarPreu(50);
assertTrue(comparaLlistesArticles(gestorArticle.obtenirArticles(),totsIncrementatsEl50pc));
}
public void incrementarPreu(float percentantge) {
//TODO completar el metode
Query ap = em.createNamedQuery("Article.aumentapreu");
ap.setParameter("quantitat", percentantge);
em.getTransaction().begin();
ap.executeUpdate();
em.getTransaction().commit();
}
I'm missing something?