Skip to content

Commit

Permalink
Add more junit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluiexo authored and Pluiexo committed Mar 15, 2024
1 parent 0028cfb commit 4f80e1e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/staffconnect/model/meeting/Meeting.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Meeting {
* Constructs a {@code Meeting}.
*
* @param description A valid meeting description.
* @param startDate A valid time and date for the meeting.
*/

public Meeting(Description description, MeetDateTime startDate) {
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/staffconnect/model/meeting/DescriptionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void isValidDescription() {
@Test
public void equals() {
Description description = new Description("Valid Description");
MeetDateTime testDate = new MeetDateTime("12/04/2023 12:00");

// same values -> returns true
assertEquals(description, new Description("Valid Description"));
Expand All @@ -59,6 +60,9 @@ public void equals() {
// different types -> returns false
assertNotEquals(5.0f, description);

//Different object type -> returns false
assertFalse(description.equals(testDate));

// different values -> returns false
assertNotEquals(description, new Name("Other valid description"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void isValidMeetDate() {
@Test
public void equals() {
MeetDateTime date = new MeetDateTime("20/01/2023 12:00");
Description testDescription = new Description("Valid Description");

// same values -> returns true
assertEquals(date, new MeetDateTime("20/01/2023 12:00"));
Expand All @@ -61,6 +62,9 @@ public void equals() {
// different types -> returns false
assertNotEquals(1234, date);

//Different object type -> returns false
assertFalse(date.equals(testDescription));

// different values -> returns false
assertNotEquals(date, new MeetDateTime("15/02/2024 12:00"));
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/staffconnect/model/meeting/MeetingTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package staffconnect.model.meeting;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

import org.junit.jupiter.api.Test;
Expand All @@ -17,6 +18,8 @@ public void equals() {
Meeting testMeeting = new Meeting(testDescription, testDate);
Meeting diffMeetingDescription = new Meeting(otherDescription, testDate);
Meeting diffMeetingTime = new Meeting(testDescription, otherDate);
MeetDateTime testDate = new MeetDateTime("12/04/2023 12:00");


// same values -> returns true
assertEquals(testMeeting, new Meeting(new Description("Valid description"),
Expand All @@ -31,6 +34,9 @@ public void equals() {
// different type -> returns false
assertNotEquals(5, testMeeting);

//Different object type -> returns false
assertFalse(testMeeting.equals(testDate));

// different description -> returns false
assertNotEquals(testMeeting, diffMeetingDescription);

Expand Down

0 comments on commit 4f80e1e

Please sign in to comment.