Skip to content

Commit

Permalink
Merge pull request #116 from rocketninja7/bug-fix
Browse files Browse the repository at this point in the history
Fix bug in edit command test
  • Loading branch information
xCOLOURx authored Oct 20, 2023
2 parents 61d7d6b + 914a093 commit 3dd61c4
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/model/module/Module.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package seedu.address.model.module;

import seedu.address.commons.util.ToStringBuilder;

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

import java.util.Set;

import seedu.address.commons.util.ToStringBuilder;

/**
* Represents a Module in the system.
* Guarantees: details are present and not null, field values are validated, immutable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import seedu.address.logic.parser.Parser;
import seedu.address.model.module.Module;
import seedu.address.model.module.ModuleCode;
import seedu.address.model.module.exceptions.ModuleNotFoundException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.function.Predicate;

import org.junit.jupiter.api.Test;

import javafx.collections.ObservableList;
import seedu.address.commons.core.GuiSettings;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.AddressBook;
import seedu.address.model.Model;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.ReadOnlyUserPrefs;
import seedu.address.model.module.Module;
import seedu.address.model.module.ModuleCode;
Expand Down
12 changes: 0 additions & 12 deletions src/test/java/seedu/address/logic/commands/CommandTestUtil.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
package seedu.address.logic.commands;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_CODE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_GRADE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_SEMESTER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
import static seedu.address.logic.parser.CliSyntax.PREFIX_YEAR;
import static seedu.address.testutil.Assert.assertThrows;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.AddressBook;
import seedu.address.model.Model;
import seedu.address.model.moduleplan.ModulePlan;
import seedu.address.model.moduleplan.ModulePlanSemester;
import seedu.address.model.person.NameContainsKeywordsPredicate;
import seedu.address.model.person.Person;
import seedu.address.testutil.EditModuleDescriptorBuilder;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void execute_allFieldsSpecified_success() {
ModuleCode moduleCode = new ModuleCode(VALID_CODE_CS2040S);
Module module = model.findModuleUsingCode(moduleCode);

Module editedModule = new ModuleBuilder().build();
Module editedModule = new ModuleBuilder().withCode(VALID_CODE_CS2040S).build();

EditModuleDescriptor descriptor = new EditModuleDescriptorBuilder(editedModule).build();
EditCommand editCommand = new EditCommand(moduleCode, descriptor);
Expand Down
11 changes: 5 additions & 6 deletions src/test/java/seedu/address/model/module/ModuleTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package seedu.address.model.module;

import org.junit.jupiter.api.Test;
import seedu.address.testutil.ModuleBuilder;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.commands.CommandTestUtil.VALID_CODE_CS2101;
import static seedu.address.logic.commands.CommandTestUtil.VALID_GRADE_CS2040S;
Expand All @@ -17,6 +13,9 @@
import static seedu.address.testutil.TypicalModules.CS2040S;
import static seedu.address.testutil.TypicalModules.CS2101;

import org.junit.jupiter.api.Test;
import seedu.address.testutil.ModuleBuilder;

public class ModuleTest {
@Test
public void isSameModule() {
Expand All @@ -39,8 +38,8 @@ public void isSameModule() {
@Test
public void equals() {
// same values -> returns true
Module CS2040SCopy = new ModuleBuilder(CS2040S).build();
assertTrue(CS2040S.equals(CS2040SCopy));
Module cS2040SCopy = new ModuleBuilder(CS2040S).build();
assertTrue(CS2040S.equals(cS2040SCopy));

// same object -> returns true
assertTrue(CS2040S.equals(CS2040S));
Expand Down
12 changes: 3 additions & 9 deletions src/test/java/seedu/address/model/moduleplan/ModulePlanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.testutil.Assert.assertThrows;
import static seedu.address.testutil.TypicalModules.GEA1000;
import static seedu.address.testutil.TypicalModules.CS2040S;


import static seedu.address.testutil.TypicalModules.GEA1000;

import java.util.Arrays;
import java.util.Collection;
Expand All @@ -21,11 +19,7 @@
import seedu.address.model.module.Module;
import seedu.address.model.module.Semester;
import seedu.address.model.module.Year;
import seedu.address.model.moduleplan.ModulePlan;
import seedu.address.model.moduleplan.ModulePlanSemester;
import seedu.address.model.moduleplan.ReadOnlyModulePlan;
import seedu.address.model.moduleplan.exceptions.DuplicateSemesterException;

import seedu.address.testutil.ModuleBuilder;
import seedu.address.testutil.TypicalModules;

Expand Down Expand Up @@ -100,8 +94,8 @@ public void getModulePlanSemesterList_modifyList_throwsUnsupportedOperationExcep

@Test
public void toStringMethod() {
// String expected = AddressBook.class.getCanonicalName() + "{persons=" + addressBook.getPersonList() + "}";
// assertEquals(expected, modulePlan.toString());
// String expected = AddressBook.class.getCanonicalName() + "{persons=" + addressBook.getPersonList() + "}";
// assertEquals(expected, modulePlan.toString());
}

/**
Expand Down

0 comments on commit 3dd61c4

Please sign in to comment.