Skip to content

Commit

Permalink
Merge pull request #18 from jinzihan2002/Zihan-9-Oct
Browse files Browse the repository at this point in the history
Add and delete assignments using AssignmentCommand
  • Loading branch information
jinzihan2002 authored Oct 10, 2024
2 parents bc7953a + e47b556 commit 8476a39
Show file tree
Hide file tree
Showing 27 changed files with 35 additions and 17 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tutorlink.command.assignment_command;
package tutorlink.command.assignmentcommand;

import tutorlink.assignment.Assignment;

Expand All @@ -11,11 +11,6 @@ public AddAssignmentCommand(Assignment assignment) {

@Override
public void execute(ArrayList assignmentList) {

}

@Override
public boolean isExit() {
return false;
assignmentList.add(assignment);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package tutorlink.command.assignment_command;
package tutorlink.command.assignmentcommand;

import tutorlink.assignment.Assignment;
import tutorlink.command.Command;

import java.util.ArrayList;

public abstract class AssignmentCommand extends Command {
private Assignment assignment;
protected Assignment assignment;

public AssignmentCommand(Assignment assignment) {
this.assignment = assignment;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tutorlink.command.assignment_command;
package tutorlink.command.assignmentcommand;

import tutorlink.assignment.Assignment;

Expand All @@ -10,6 +10,6 @@ public DeleteAssignmentCommand(Assignment assignment) {
}

public void execute(ArrayList assignmentList) {

assignmentList.remove(assignment);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tutorlink.command.attendance_command;
package tutorlink.command.attendancecommand;

import tutorlink.attendance.Attendance;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tutorlink.command.attendance_command;
package tutorlink.command.attendancecommand;

import tutorlink.attendance.Attendance;
import tutorlink.command.Command;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tutorlink.command.attendance_command;
package tutorlink.command.attendancecommand;

import tutorlink.attendance.Attendance;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tutorlink.command.student_command;
package tutorlink.command.studentcommand;

import tutorlink.student.Student;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tutorlink.command.student_command;
package tutorlink.command.studentcommand;

import tutorlink.command.Command;
import tutorlink.student.Student;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tutorlink.command.student_command;
package tutorlink.command.studentcommand;

import tutorlink.student.Student;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package tutorlink.command.assignmentcommand;

import org.junit.jupiter.api.Test;
import tutorlink.assignment.Assignment;

import java.util.ArrayList;

import static org.junit.jupiter.api.Assertions.*;

class AddAssignmentCommandTest {
@Test
void execute_addOne_expectOne() {
// setup
ArrayList<Assignment> assignmentList = new ArrayList<>();
Assignment assignment1 = new Assignment("Test_1",100,100,0.2);
AddAssignmentCommand addAssignmentCommand = new AddAssignmentCommand(assignment1);
// execute
addAssignmentCommand.execute(assignmentList);
assertFalse(assignmentList.isEmpty());
assertEquals(1, assignmentList.size());
assertEquals(assignment1, assignmentList.get(0));
}
}

0 comments on commit 8476a39

Please sign in to comment.