Skip to content

Commit

Permalink
Completed A-JUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnTekTeoh committed Feb 3, 2020
1 parent bf0106e commit bcff413
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 0 deletions.
Binary file added lib/apiguardian-api-1.0.0.jar
Binary file not shown.
Binary file added lib/bsh-2.0b6.jar
Binary file not shown.
Binary file added lib/jcommander-1.72.jar
Binary file not shown.
Binary file added lib/junit-jupiter-5.4.2.jar
Binary file not shown.
Binary file added lib/junit-jupiter-api-5.4.2.jar
Binary file not shown.
Binary file added lib/junit-jupiter-engine-5.4.2.jar
Binary file not shown.
Binary file added lib/junit-jupiter-params-5.4.2.jar
Binary file not shown.
Binary file added lib/junit-platform-commons-1.4.2.jar
Binary file not shown.
Binary file added lib/junit-platform-engine-1.4.2.jar
Binary file not shown.
Binary file added lib/opentest4j-1.1.1.jar
Binary file not shown.
Binary file added lib/testng-6.14.3.jar
Binary file not shown.
1 change: 1 addition & 0 deletions src/main/java/duke/entity/command/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

public abstract class Command {


/**
* Executes the task based on the eventual type
*
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/test/java/duke/entity/task/DeadlineTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package test.java.duke.entity.task;

import duke.entity.task.Deadline;
import org.junit.jupiter.api.Test;

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

class DeadlineTest {

@Test
void printTask_withDateTimeFormatChange_success() {
assertEquals(new Deadline("do homework", "2020-02-10 19:00").printTask(), "[D][\u2718] do homework (by: Mon, 10 Feb 2020 07:00 PM)");
}
}
19 changes: 19 additions & 0 deletions src/main/java/test/java/duke/parser/CommandParserTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package test.java.duke.parser;

import duke.entity.command.AddCommand;
import duke.entity.task.Event;
import duke.entity.task.Todo;
import duke.handler.Ui;
import duke.parser.CommandParser;
import org.testng.annotations.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

public class CommandParserTest {

@Test
public void parse_todoCommand_success() {
assertEquals(new AddCommand(new Todo("read book")).getNewTask().getTaskName(), ((AddCommand) new CommandParser(new Ui()).parse("todo read book")).getNewTask().getTaskName());
}
}
22 changes: 22 additions & 0 deletions src/main/java/test/java/duke/parser/DateTimeParserTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package test.java.duke.parser;

import duke.parser.DateTimeParser;
import org.junit.jupiter.api.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;

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

class DateTimeParserTest {

@Test
void parseDate_20200201_success() throws ParseException {
assertEquals(new DateTimeParser().parseDate("2020-02-01").getTime(), new SimpleDateFormat("yyyy-MM-dd").parse("2020-02-01").getTime());
}

@Test
void parseTime() throws ParseException {
assertEquals(new DateTimeParser().parseTime("18:00").getTime(), new SimpleDateFormat("HH:mm").parse("18:00").getTime());
}
}

0 comments on commit bcff413

Please sign in to comment.