Skip to content

Commit

Permalink
Merge pull request #12 from BestDownLoader365/command_and_Junit_test
Browse files Browse the repository at this point in the history
test how Junit works
  • Loading branch information
BestDownLoader365 committed Mar 15, 2024
2 parents 261a27e + 2a37db6 commit 176742a
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test {
}

application {
mainClass.set("seedu.duke.Duke")
mainClass.set("main.CalculaChroniclesOfTheAlgorithmicKingdom")
}

shadowJar {
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/command/Command.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
package command;

import java.util.ArrayList;

public abstract class Command {

protected String commandDescription;
protected ArrayList<ArrayList<Character>> currentMap;
public abstract void execute();
public Command(){
commandDescription = "Impossible";
currentMap = null;
}
public String getCommandDescription(){
return commandDescription;
}
public ArrayList<ArrayList<Character>> getCurrentMap(){
return currentMap;
}
}
6 changes: 5 additions & 1 deletion src/main/java/command/fight/FightingCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
import command.Command;

public class FightingCommand extends Command {
public FightingCommand() {
commandDescription = "FIGHT!";
}

@Override
public void execute(){
public void execute() {

}
}
3 changes: 3 additions & 0 deletions src/main/java/command/fight/RunningCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import command.Command;

public class RunningCommand extends Command {
public RunningCommand() {
commandDescription = "RUN!";
}
@Override
public void execute(){

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/command/mapmove/InteractingCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
public class InteractingCommand extends MapMoveCommand {
@Override
public void execute() {

}
}
11 changes: 11 additions & 0 deletions src/test/java/command/CommandTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package command;

import org.junit.jupiter.api.BeforeEach;

public class CommandTest {
Command a;
@BeforeEach
void setup(){

}
}
20 changes: 20 additions & 0 deletions src/test/java/command/fight/FightCommandTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package command.fight;

import command.Command;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

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

public class FightCommandTest {
Command a;
@BeforeEach
void setup() {
a = new FightingCommand();
}

@Test
void fightExecuteCorrectly() {
assertEquals("FIGHT!", a.getCommandDescription());
}
}
4 changes: 4 additions & 0 deletions src/test/java/command/mapmove/MapMoveCommandTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package command.mapmove;

public class MapMoveCommandTest {
}

0 comments on commit 176742a

Please sign in to comment.