forked from nusCS2113-AY1920S1/PersonalAssistant-Duke
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from AY1920S1-CS2113T-F14-3/master
getting test.txt data set
- Loading branch information
Showing
4 changed files
with
41 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package Operations; | ||
|
||
import CustomExceptions.RoomShareException; | ||
import Enums.ExceptionType; | ||
import Model_Classes.Assignment; | ||
|
||
public class subTaskCreator { | ||
public subTaskCreator(int index, String subTasks) throws RoomShareException { | ||
if (TaskList.currentList().get(index) instanceof Assignment) { | ||
((Assignment) TaskList.currentList().get(index)).setSubTasks(subTasks); | ||
} else { | ||
throw new RoomShareException(ExceptionType.subTask); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,54 @@ | ||
import CustomExceptions.RoomShareException; | ||
import Enums.TimeUnit; | ||
import Model_Classes.Meeting; | ||
import Operations.CheckAnomaly; | ||
import Operations.Storage; | ||
import Operations.TaskList; | ||
import Operations.Parser; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.sql.Time; | ||
import java.util.Date; | ||
|
||
public class CheckAnomalyTest { | ||
private static final Parser parser = new Parser(); | ||
private static final Storage storage = new Storage(); | ||
private static Meeting meeting; | ||
private static Meeting meeting1, meeting2, meeting3, meeting4, meeting5; | ||
private static Date at1, at2, at3, at4, at5; | ||
private static TaskList taskList; | ||
|
||
static { | ||
try { | ||
at1 = parser.formatDateCustom_1("12/12/2019 12:00"); | ||
at2 = parser.formatDateCustom_1("20/12/2019 12:00"); | ||
at1 = parser.formatDateCustom_1("12/12/2019 17:00"); | ||
at2 = parser.formatDateCustom_1("12/12/2019 19:00"); | ||
at3 = parser.formatDateCustom_1("12/12/2019 10:00"); | ||
at4 = parser.formatDateCustom_1("20/12/2019 13:00"); | ||
at5 = parser.formatDateCustom_1("21/12/2019 13:00"); | ||
taskList = new TaskList(storage.loadFile("data.txt")); | ||
Meeting event = new Meeting("test2", at2); | ||
taskList = new TaskList(storage.loadFile("test.txt")); | ||
meeting1 = new Meeting("test1", at1, 2, TimeUnit.hours); | ||
meeting2 = new Meeting("test2", at2); | ||
meeting3 = new Meeting("test3", at3); | ||
meeting4 = new Meeting("test4", at4, 2, TimeUnit.hours); | ||
meeting5 = new Meeting("test5", at5); | ||
} catch (RoomShareException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
/* | ||
@Test | ||
public void timeCheckFixedTest() { assertEquals(true, new CheckAnomaly().checkTime(new Meeting()); } | ||
public void durationClashOverlap() { assertEquals(true, new CheckAnomaly().checkTask(meeting1)); } | ||
|
||
@Test | ||
public void timeCheckOnlyDateTrueTest() { | ||
assertEquals(true, new CheckAnomaly().checkTime(at1)); | ||
} | ||
public void durationClashIntersect() { assertEquals(true, new CheckAnomaly().checkTask(meeting2)); } | ||
|
||
@Test | ||
public void timeCheckOnlyDateFalseTest() { | ||
assertEquals(false, new CheckAnomaly().checkTime(at5)); | ||
} | ||
*/ | ||
public void fixedClashIntersect() { assertEquals(true, new CheckAnomaly().checkTask(meeting3)); } | ||
|
||
@Test | ||
public void fixedClashOverlap() { assertEquals(true, new CheckAnomaly().checkTask(meeting4)); } | ||
|
||
@Test | ||
public void noClash() { assertEquals(false, new CheckAnomaly().checkTask(meeting5)); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
M#n#low#test1#12/12/2019 18:00#none#everyone#F#2#hours## | ||
M#n#low#test2#12/12/2019 10:00#none#everyone#N#0#unDefined## |