Policy failures:
Code warning - failed on resource EvaluationManagerTest.java. Reason: The field EvaluationManagerTest.cm is never read locally, line 32 - failed on resource EvaluationManagerTest.java. Reason: The field EvaluationManagerTest.um is never read locally, line 33 - failed on resource EvaluationManagerTest.java. Reason: The import java.util.Date is never used, line 6 - failed on resource EvaluationManagerTest.java. Reason: The import org.yacos.core.conferences.Conference is never used, line 1 Override reason: d
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
package org.yacos.tests.core;
|
package org.yacos.tests.core;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -22,6 +20,7 @@ import org.yacos.core.conferences.Conference;
|
|||||||
import org.yacos.core.conferences.IConferenceManager;
|
import org.yacos.core.conferences.IConferenceManager;
|
||||||
import org.yacos.core.evaluation.Criterion;
|
import org.yacos.core.evaluation.Criterion;
|
||||||
import org.yacos.core.evaluation.IEvaluationManager;
|
import org.yacos.core.evaluation.IEvaluationManager;
|
||||||
|
import org.yacos.core.evaluation.Rating;
|
||||||
import org.yacos.core.evaluation.Report;
|
import org.yacos.core.evaluation.Report;
|
||||||
import org.yacos.core.exceptions.PKAlreadyUsedException;
|
import org.yacos.core.exceptions.PKAlreadyUsedException;
|
||||||
import org.yacos.core.users.IUserManager;
|
import org.yacos.core.users.IUserManager;
|
||||||
@@ -46,31 +45,28 @@ public class EvaluationManagerTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void initDB(){
|
public void initDB(){
|
||||||
Conference conf = cm.addConference("titre","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date());
|
/*Conference conf = cm.addConference("titre","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date());
|
||||||
confId = conf.getId();
|
confId = conf.getId();
|
||||||
|
*/
|
||||||
|
confId = 1;
|
||||||
article = am.addArticle("title article max","topic","url_article",
|
article = am.addArticle("title article max","topic","url_article",
|
||||||
"max", new ArrayList<String>(), Article.State.SUMMARY, confId);
|
"max", new ArrayList<String>(), Article.State.SUMMARY, confId);
|
||||||
|
//article = am.getArticle(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void cleanDB(){
|
public void cleanDB(){
|
||||||
cm.remove(confId);
|
am.removeArticle(article.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addCriterionsTest() {
|
public void add_et_getCriterionsTest() {
|
||||||
Criterion crit = em.addCriterion("name", 0, 4, confId);
|
Criterion crit = em.addCriterion("name", 0, 4, confId);
|
||||||
assertNotNull(crit);
|
assertNotNull(crit);
|
||||||
assertEquals(crit.getName(), em.getCriterion(crit.getId()).getName());
|
assertEquals(crit.getName(), em.getCriterion(crit.getId()).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getCriterionTest(){
|
|
||||||
Criterion crit = em.getCriterion(1);
|
|
||||||
assertNotNull(crit);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getCriterionsTest() throws NamingException{
|
public void getCriterionsTest() throws NamingException{
|
||||||
em.addCriterion("name", 0, 4, confId);
|
em.addCriterion("name", 0, 4, confId);
|
||||||
@@ -95,12 +91,56 @@ public class EvaluationManagerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void AddReportTest(){
|
public void AddReportTest(){
|
||||||
List<Criterion> ratings = new ArrayList<Criterion>();
|
List<Rating> ratings = new ArrayList<Rating>();
|
||||||
//Report report = em.addReport(article, "commentPCMember", "commentAuthor", ratings, um.getUser("max"));
|
Report report = em.addReport(article.getId(), "commentPCMember", "commentAuthor", ratings, "max");
|
||||||
//assertNotNull();
|
|
||||||
//assertEquals(report.getCommentAuthor(), em.getReport(report.getId()).getCommentAuthor());
|
|
||||||
|
|
||||||
|
//assertNotNull(em.getReportforArticleAndReferee(article.getId(), "max"));
|
||||||
|
assertEquals(report.getCommentAuthor(), em.getReport(report.getId()).getCommentAuthor());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateReportTest(){
|
||||||
|
Report report = em.addReport(article.getId(), "commentPCMember", "commentAuthor", new ArrayList<Rating>(), "max");
|
||||||
|
report.setCommentPCMember("autre");
|
||||||
|
em.updateReport(report);
|
||||||
|
assertEquals("autre", em.getReport(report.getId()).getCommentPCMember());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void removeReportTest(){
|
||||||
|
Report report = em.addReport(article.getId(), "report a virer", "commentAuthor", new ArrayList<Rating>(), "max");
|
||||||
|
em.removeReport(report.getId());
|
||||||
|
assertNull(em.getReport(report.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getReportforArticleAndRefereeTest(){
|
||||||
|
Report report = em.addReport(article.getId(), "report a virer", "commentAuthor", new ArrayList<Rating>(), "max");
|
||||||
|
Report report2 =em.getReportforArticleAndReferee(article.getId(), "max");
|
||||||
|
assertEquals(report.getId(), report2.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getReportsForArticleTest(){
|
||||||
|
em.addReport(article.getId(), "report a virer", "commentAuthor", new ArrayList<Rating>(), "admin");
|
||||||
|
em.addReport(article.getId(), "report a virer", "commentAuthor", new ArrayList<Rating>(), "max");
|
||||||
|
List <Report> list = em.getReportsForArticle(article.getId());
|
||||||
|
assertTrue(list.size() == 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void getReportsForRefereeTest(){
|
||||||
|
em.addReport(article.getId(), "report a virer", "commentAuthor", new ArrayList<Rating>(), "admin");
|
||||||
|
em.addReport(article.getId(), "report a virer", "commentAuthor", new ArrayList<Rating>(), "max");
|
||||||
|
List <Report> list = em.getReportsForReferee("max");
|
||||||
|
assertTrue(list.size() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getRatingsFromReport(){
|
||||||
|
assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user