Commit c67b6f16 authored by Jean-Mael BOIS's avatar Jean-Mael BOIS
Browse files

Test the name of Task - Fix #34

Test the name of Project - Fix #35
The test of isTrash show problem in putInTrash function - #31
Beginning of all the test of Task - #38
parent b258b884
......@@ -4,6 +4,7 @@ import fr.alma.gtd.server.core.IParticipant;
import fr.alma.gtd.server.core.IProject;
import fr.alma.gtd.server.core.ITask;
import fr.alma.gtd.server.persistence.data.Utilisateur;
import org.hibernate.validator.AssertFalse;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
......@@ -152,4 +153,38 @@ public class ProjectTest {
assertTrue(this.project.getParticipantsList().contains(u3));
assertFalse(u2.getProjectReference().contains(this.project));
}
@Test
public void testIsTrash() {
ArrayList<ITask> tasks = new ArrayList<>();
Task t6 = new Task();
Task t7 = new Task();
Task t8 = new Task();
tasks.add(t6);
tasks.add(t7);
tasks.add(t8);
project.setTasksList(tasks);
assertFalse(this.project.isTrash());
project.putInTrash();
assertTrue(this.project.isTrash());
List<ITask> tasks2 = project.getTasksList();
for(ITask t : tasks2) {
assertTrue(t.isTrash());
}
}
@Test
public void testProjectName() {
String name = "Beautiful project";
this.project.setName(name);
assertEquals(this.project.getName(), name);
}
}
\ No newline at end of file
package fr.alma.gtd.server.main.donnees;
import fr.alma.gtd.server.core.Frequency;
import fr.alma.gtd.server.core.IParticipant;
import fr.alma.gtd.server.core.ITag;
import fr.alma.gtd.server.core.Progress;
import fr.alma.gtd.server.persistence.data.Utilisateur;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
......@@ -39,6 +41,84 @@ class TaskTest {
}
@Test
public void testName() {
String name = "Beautiful task";
this.task.setName(name);
assertEquals(this.task.getName(), name);
String new_name = "Beautiful task";
this.task.setName(new_name);
assertEquals(this.task.getName(), new_name);
}
@Test
public void testPriority() {
this.task.setPriority(15);
assertEquals(15, this.task.getPriority());
this.task.setPriority(10);
assertEquals(10, this.task.getPriority());
}
@Test
public void testEffortRate() {
this.task.setEffortRate(15);
assertEquals(15, this.task.getEffortRate());
this.task.setEffortRate(10);
assertEquals(10, this.task.getEffortRate());
}
@Test
public void testProgress() {
this.task.setProgress(Progress.TODO);
assertEquals(Progress.TODO, this.task.getProgress());
this.task.setProgress(Progress.COMPLETED);
assertEquals(Progress.COMPLETED, this.task.getProgress());
}
@Test
public void testFrequency() {
this.task.setFrequency(Frequency.DAILY);
assertEquals(Frequency.DAILY, this.task.getFrequency());
this.task.setFrequency(Frequency.ANNUAL);
assertEquals(Frequency.ANNUAL, this.task.getFrequency());
}
@Test
public void testDates() {
Date date = new Date();
this.task.setBeginningDate(date);
assertEquals(date, this.task.getBeginningDate());
this.task.setEndingDate(date);
assertEquals(date, this.task.getEndingDate());
Date new_date = new Date();
assertNotEquals(new_date, date);
}
@Test
public void testIsTrash() {
assertFalse(this.task.isTrash());
this.task.setTrash(true);
assertTrue(this.task.isTrash());
}
@Test
public void testContextAssociation() {
Context c1 = new Context();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment