Skip to content

Commit 277783a

Browse files
committed
Fix old test assertions to match updated error messages
1 parent d116b74 commit 277783a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/test/java/flora/FloraTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ public void parser_parseTodo_returnsAddTodoCommand() throws FloraException {
503503
@Test
504504
public void parseTodo_noDescription_throwsException() {
505505
FloraException ex = assertThrows(FloraException.class, () -> Parser.parse("todo"));
506-
assertEquals("At least put something bro", ex.getMessage());
506+
assertTrue(ex.getMessage().contains("Please provide a description for your todo"));
507507
}
508508

509509
@Test
@@ -515,7 +515,7 @@ public void parser_parseDeadline_returnsAddDeadlineCommand() throws FloraExcepti
515515
@Test
516516
public void parseDeadline_noBy_throwsException() {
517517
FloraException ex = assertThrows(FloraException.class, () -> Parser.parse("deadline submit report"));
518-
assertEquals("At least set a due date bro", ex.getMessage());
518+
assertTrue(ex.getMessage().contains("Please provide a due date using /by"));
519519
}
520520

521521
@Test
@@ -533,14 +533,14 @@ public void parser_parseEvent_returnsAddEventCommand() throws FloraException {
533533
public void parseEvent_noFrom_throwsException() {
534534
FloraException ex = assertThrows(FloraException.class, () ->
535535
Parser.parse("event meeting /to 6/8/2024 16:00"));
536-
assertEquals("At least set a start time bro", ex.getMessage());
536+
assertTrue(ex.getMessage().contains("Please provide a start time using /from"));
537537
}
538538

539539
@Test
540540
public void parseEvent_noTo_throwsException() {
541541
FloraException ex = assertThrows(FloraException.class, () ->
542542
Parser.parse("event meeting /from 6/8/2024"));
543-
assertEquals("At least set an end time bro", ex.getMessage());
543+
assertTrue(ex.getMessage().contains("Please provide an end time using /to"));
544544
}
545545

546546
@Test
@@ -582,13 +582,13 @@ public void parser_parseFind_returnsFindCommand() throws FloraException {
582582
@Test
583583
public void parseFind_noKeyword_throwsException() {
584584
FloraException ex = assertThrows(FloraException.class, () -> Parser.parse("find"));
585-
assertEquals("Put a keyword.", ex.getMessage());
585+
assertTrue(ex.getMessage().contains("Please provide a keyword to search for"));
586586
}
587587

588588
@Test
589589
public void parseMark_noIndex_throwsException() {
590590
FloraException ex = assertThrows(FloraException.class, () -> Parser.parse("mark"));
591-
assertEquals("At least put an index bro", ex.getMessage());
591+
assertTrue(ex.getMessage().contains("Please provide a task number"));
592592
}
593593

594594
@Test
@@ -630,7 +630,7 @@ public void parseEdit_allFields_returnsEditCommand() throws FloraException {
630630
@Test
631631
public void parseEdit_noIndex_throwsException() {
632632
FloraException ex = assertThrows(FloraException.class, () -> Parser.parse("edit"));
633-
assertEquals("At least put an index bro", ex.getMessage());
633+
assertTrue(ex.getMessage().contains("Please provide a task number to edit"));
634634
}
635635

636636
@Test
@@ -641,13 +641,13 @@ public void parseEdit_invalidIndexNonNumeric_throwsException() {
641641
@Test
642642
public void parseEdit_zeroIndex_throwsException() {
643643
FloraException ex = assertThrows(FloraException.class, () -> Parser.parse("edit 0 /desc x"));
644-
assertTrue(ex.getMessage().contains("Invalid task index"));
644+
assertTrue(ex.getMessage().contains("Task number must be a positive number"));
645645
}
646646

647647
@Test
648648
public void parseEdit_noFields_throwsException() {
649649
FloraException ex = assertThrows(FloraException.class, () -> Parser.parse("edit 1"));
650-
assertTrue(ex.getMessage().contains("At least change something"));
650+
assertTrue(ex.getMessage().contains("No fields to update were provided"));
651651
}
652652

653653
@Test
@@ -668,14 +668,14 @@ public void parseEdit_fromAndToEqual_throwsException() {
668668
public void parseEvent_startAfterEnd_throwsException() {
669669
FloraException ex = assertThrows(FloraException.class, () ->
670670
Parser.parse("event meeting /from 6/8/2024 16:00 /to 6/8/2024 14:00"));
671-
assertTrue(ex.getMessage().contains("Start time must be before end time"));
671+
assertTrue(ex.getMessage().contains("start time must be before the end time"));
672672
}
673673

674674
@Test
675675
public void parseEvent_startEqualsEnd_throwsException() {
676676
FloraException ex = assertThrows(FloraException.class, () ->
677677
Parser.parse("event meeting /from 6/8/2024 14:00 /to 6/8/2024 14:00"));
678-
assertTrue(ex.getMessage().contains("Start time must be before end time"));
678+
assertTrue(ex.getMessage().contains("start time must be before the end time"));
679679
}
680680

681681
// ==================== Parser: non-existent dates ====================
@@ -1033,7 +1033,7 @@ public void markCommand_alreadyMarked_returnsInfoMessage() throws FloraException
10331033
tasks.add(task);
10341034
MarkCommand cmd = new MarkCommand(1);
10351035
cmd.execute(tasks, null); // Won't save since task is already marked
1036-
assertEquals("That task is already marked bro", cmd.getMessage());
1036+
assertEquals("That task is already marked as done.", cmd.getMessage());
10371037
}
10381038

10391039
@Test
@@ -1072,7 +1072,7 @@ public void unmarkCommand_alreadyUnmarked_returnsInfoMessage() throws FloraExcep
10721072
tasks.add(new Todo("buy milk")); // Not marked by default
10731073
UnmarkCommand cmd = new UnmarkCommand(1);
10741074
cmd.execute(tasks, null); // Won't save since task is already unmarked
1075-
assertEquals("That task is already unmarked bro", cmd.getMessage());
1075+
assertEquals("That task is already marked as not done.", cmd.getMessage());
10761076
}
10771077

10781078
@Test

0 commit comments

Comments
 (0)