Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2021S1#69 from lucastai98/branch-meeting
Browse files Browse the repository at this point in the history
add tests for meeting class
  • Loading branch information
TCQian authored Oct 5, 2020
2 parents fadbb34 + c3570dd commit a53cd81
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/seedu/address/model/meeting/Meeting.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package seedu.address.model.meeting;

import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.Temporal;
Expand All @@ -17,11 +20,13 @@ public class Meeting {

/**
* Constructor for meeting.
* Date and timing for the meeting should be present and not null.
*
* @param name name of meeting
* @param localDateTime date and time of meeting
*/
public Meeting(String name) {
this.name = name;
public Meeting(String localDateTime) {
requireAllNonNull(localDateTime);
startDateTime = LocalDateTime.parse(localDateTime);
isDone = false;
}

Expand Down
20 changes: 20 additions & 0 deletions src/test/java/seedu/address/model/meeting/MeetingTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package seedu.address.model.meeting;

import static seedu.address.testutil.Assert.assertThrows;

import org.junit.jupiter.api.Test;

public class MeetingTest {

@Test
public void constructor_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> new Meeting(null));
}

@Test
public void constructor_invalidMeeting_throwsIllegalArgumentException() {
assertThrows(java.time.format.DateTimeParseException.class, () -> new Meeting(""));

}

}

0 comments on commit a53cd81

Please sign in to comment.