diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..a1f0c208547f630fbf76faf94a9da5f9d831de25 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/.DS_store/ +/target/ +*.iml +/.idea/ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..73f69e0958611ac6e00bde95641f6699030ad235 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000000000000000000000000000000000000..e7513069e386c2580dda25846413c004c11195e9 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="CompilerConfiguration"> + <annotationProcessing> + <profile name="Maven default annotation processors profile" enabled="true"> + <sourceOutputDir name="target/generated-sources/annotations" /> + <sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> + <outputRelativeToContentRoot value="true" /> + <module name="WarGame" /> + </profile> + </annotationProcessing> + </component> +</project> \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..aa00ffab7828f4818589659c804ec2cfd99baed3 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Encoding"> + <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> + <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000000000000000000000000000000000..d18f7edc1b1e485edbceb45904f57885f6f20fc9 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ +<component name="InspectionProjectProfileManager"> + <profile version="1.0"> + <option name="myName" value="Project Default" /> + <inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true"> + <Languages> + <language minSize="47" name="Java" /> + </Languages> + </inspection_tool> + </profile> +</component> \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000000000000000000000000000000000000..712ab9d985c20018a0c97b93d2148ac1ffe588a5 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="RemoteRepositoriesConfiguration"> + <remote-repository> + <option name="id" value="central" /> + <option name="name" value="Central Repository" /> + <option name="url" value="https://repo.maven.apache.org/maven2" /> + </remote-repository> + <remote-repository> + <option name="id" value="central" /> + <option name="name" value="Maven Central repository" /> + <option name="url" value="https://repo1.maven.org/maven2" /> + </remote-repository> + <remote-repository> + <option name="id" value="jboss.community" /> + <option name="name" value="JBoss Community repository" /> + <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> + </remote-repository> + </component> +</project> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..b95cec74382b96ec6572776fe0de8779385bc174 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ExternalStorageConfigurationManager" enabled="true" /> + <component name="MavenProjectsManager"> + <option name="originalFiles"> + <list> + <option value="$PROJECT_DIR$/pom.xml" /> + </list> + </option> + </component> + <component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="16" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/out" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000000000000000000000000000000000000..797acea53eb091cf5b30518802c3073f544adeed --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="RunConfigurationProducerService"> + <option name="ignoredProducers"> + <set> + <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" /> + </set> + </option> + </component> +</project> \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000000000000000000000000000000000000..e96534fb27b68192f27f985d3879e173ec77adb8 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Palette2"> + <group name="Swing"> + <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> + </item> + <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> + </item> + <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> + <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> + <initial-values> + <property name="text" value="Button" /> + </initial-values> + </item> + <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="RadioButton" /> + </initial-values> + </item> + <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="CheckBox" /> + </initial-values> + </item> + <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="Label" /> + </initial-values> + </item> + <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> + <preferred-size width="200" height="200" /> + </default-constraints> + </item> + <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> + <preferred-size width="200" height="200" /> + </default-constraints> + </item> + <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> + </item> + <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> + <preferred-size width="-1" height="20" /> + </default-constraints> + </item> + <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> + </item> + <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> + </item> + </group> + </component> +</project> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..94a25f7f4cb416c083d265558da75d457237d671 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/WarGames.bmpr b/WarGames.bmpr new file mode 100644 index 0000000000000000000000000000000000000000..3ee754979bd1eb82bb403ca56b659ffe9baa9bbb Binary files /dev/null and b/WarGames.bmpr differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a6a415905ff8eefdf8814f42470ff221db54570d --- /dev/null +++ b/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>edu.ntnu.idatt2001.Project</groupId> + <artifactId>wargame</artifactId> + <version>0.1-SNAPSHOT</version> + + <properties> + <maven.compiler.source>16</maven.compiler.source> + <maven.compiler.target>16</maven.compiler.target> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.22.0</version> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>5.8.2</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <version>5.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + +</project> \ No newline at end of file diff --git a/src/main/java/BattleSimulation/Army.java b/src/main/java/BattleSimulation/Army.java new file mode 100644 index 0000000000000000000000000000000000000000..147483b1f4458e07f1ce4beabfba13076c773f20 --- /dev/null +++ b/src/main/java/BattleSimulation/Army.java @@ -0,0 +1,182 @@ +package BattleSimulation; +import SpecificUnits.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Class representing a full army, with different methods for handling the mechanics of an army + */ +public class Army { + + private List<Unit> units; + private String name; + + /** + * A constructor with a list, and the name of that list + * @param name army name + */ + public Army(String name) { + units = new ArrayList<>(); + this.name = name; + } + + /** + * A constructor created with a list and a name of the army object created + * @param name name of army + * @param units list of units + */ + public Army(String name, List<Unit> units){ + this.name = name; + this.units = units; + } + + /** + * the get method for the name of the army + * @return String with the name of the army + */ + public String getName() { + return name; + } + + /** + * method for adding a unit to the army + * @param unit chosen unit to add to army + */ + public void add(Unit unit){ + units.add(unit); + } + + /** + * method for adding multiple units at one + * @param newUnits the list of the new units + */ + public void addAll(List<Unit> newUnits){ + units.addAll(newUnits); + } + + /** + * method for removing a specific unit in the army + * @param unit the unit to remove + */ + public void remove(Unit unit){ + units.remove(unit); + } + + /** + * method that return true if a list is empty or not + * @return true if the list is empty, false if it has units + */ + public boolean hasUnits(){ + if(units.size() > 0){ + return true; + } + return false; + } + + /** + * method for getting all units + * @return a list of the unit + */ + public List<Unit> getAllUnits(){ + return units; + } + + /** + * method for getting a random unit for a list + * @return a random unit + */ + public Unit getRandom(){ + java.util.Random random = new java.util.Random(); + int randomNum = random.nextInt(units.size()); + return units.get(randomNum); + } + + /** + * this is a getmethod for getting the list of all units in an army + * @return list of unit in the army + */ + public List<Unit> getUnits() { + return units; + } + + /** + * methods for getting all infantryUnits in a army + * @return a new list of all infantryUnits + */ + public List<Unit> getInfantryUnits(){ + return getUnits().stream() + .filter(u -> u instanceof InfantryUnit) + .collect(Collectors.toCollection(ArrayList::new)); + } + + /** + * methods for getting all RangeUnitsUnits in a army + * @return a new list of all RangeUnits + */ + public List<Unit> getRangeUnits(){ + return getUnits().stream() + .filter(u -> u instanceof RangedUnit) + .collect(Collectors.toCollection(ArrayList::new)); + } + + /** + * methods for getting all CavalryUnits in a army + * @return a new list of all CavalryUnits + */ + public List<Unit> getCavalryUnits(){ + return getUnits().stream() + .filter(u -> u instanceof CavalryUnit && !(u instanceof CommanderUnit)) + .collect(Collectors.toCollection(ArrayList::new)); + } + + /** + * methods for getting all CommanderUnits in a army + * @return a new list of all CommanderUnits + */ + public List<Unit> getCommanderUnits(){ + return getUnits().stream() + .filter(u -> u instanceof CommanderUnit) + .collect(Collectors.toCollection(ArrayList::new)); + } + + + /** + * if a object is the same as a different unit + * @param o object to check + * @return true if the units are equal, false if not + */ + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof Army)) return false; + + Army army = (Army) o; + + if (!Objects.equals(units, army.units)) return false; + return getName() != null ? getName().equals(army.getName()) : army.getName() == null; + } + + /** + * method that makes a hashcode for an object + * @return int as a hashcode for the different objects + */ + @Override + public int hashCode() { + int result = units != null ? units.hashCode() : 0; + result = 31 * result + (getName() != null ? getName().hashCode() : 0); + return result; + } + + /** + * a toString method for printing a units list + * @return a string of units + */ + @Override + public String toString() { + return name + + "\nunits=" + units; + } +} diff --git a/src/main/java/BattleSimulation/Battle.java b/src/main/java/BattleSimulation/Battle.java new file mode 100644 index 0000000000000000000000000000000000000000..9964db7b495da622c40e848382cdb71210f28b50 --- /dev/null +++ b/src/main/java/BattleSimulation/Battle.java @@ -0,0 +1,90 @@ +package BattleSimulation; +import SpecificUnits.Unit; +import java.util.Random; + +/** + * this class represents the simulation of a battle + * the battle is going to be between two armies from the army class + * this class consists of different methods and variables + */ +public class Battle { + + Army attackingArmy; + Army defendingArmy; + Army armyOne; + Army armyTwo; + + /** + * this is a constructor for the battle class that takes two classes. + * @param armyOne + * @param armyTwo + */ + public Battle(Army armyOne, Army armyTwo) { + this.armyOne = armyOne; + this.armyTwo = armyTwo; + } + + /** + * this method is the simulation of the battle, two armies attack each other, and one wins + * @return return the winning army as an Army object + */ + public Army simulate(){ + Army winningArmy; + + Random random = new Random(); + boolean randomBool = random.nextBoolean(); + + if (randomBool){ + attackingArmy = armyOne; + defendingArmy = armyTwo; + } else { + attackingArmy = armyTwo; + defendingArmy = armyOne; + } + + boolean winner; + while (armyOne.hasUnits() && armyTwo.hasUnits()){ + + Unit attackingUnit = attackingArmy.getRandom(); + Unit defendingUnit = defendingArmy.getRandom(); + + winner = false; + while (!winner){ + attackingUnit.attack(defendingUnit); + if (defendingUnit.getHealth() <= 0){ + defendingArmy.remove(defendingUnit); + winner = true; + } + else { + defendingUnit.attack(attackingUnit); + if (attackingUnit.getHealth() <= 0){ + attackingArmy.remove(attackingUnit); + winner = true; + } + } + } + } + if(armyOne.hasUnits()){ + winningArmy = armyOne; + } else { + winningArmy = armyTwo; + } + return winningArmy; + } + + /** + * this method chooses the starting/attacking and defending army + */ + public void whoStarts(){ + } + + /** + * the toString method that print out both armies + * @return both armies units + */ + @Override + public String toString() { + return armyOne.getName() +"\n"+ armyOne.getAllUnits() + + "\n\n" + armyTwo.getName() +"\n"+ armyTwo.getAllUnits(); + } +} \ No newline at end of file diff --git a/src/main/java/BattleSimulation/armyFiles.java b/src/main/java/BattleSimulation/armyFiles.java new file mode 100644 index 0000000000000000000000000000000000000000..4ba4ab7970dcb2071bf170596554d0738f88c834 --- /dev/null +++ b/src/main/java/BattleSimulation/armyFiles.java @@ -0,0 +1,119 @@ +package BattleSimulation; + +import SpecificUnits.*; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class armyFiles { + + /** + * method that takes a unit and converts it to a string of csv type + * @param u the unit you want to convert + * @return string of csv type of the specific unit + */ + public static String makeCSVString(Unit u){ + return u.getClass().getSimpleName() +","+ u.getName()+","+u.getHealth()+","+u.getAttack()+","+u.getArmor() + +","+u.getMelee()+"\n"; + } + + /** + * method that creates a file from an army with the armys name + * @param army the army you want to create a file of + * @return File with the new army + * @throws IOException if file not found, or file is wrong throws exception + */ + public static File makeCSVFile(Army army) throws IOException{ + //makes a new file in the armyFile folder with the army name + File armyFile = new File("src/main/resources/armyFiles/"+army.getName().trim()); + + //checks if file is already in registry + if(armyFile.exists() && !armyFile.isDirectory()) { + throw new IllegalArgumentException("This ArmyFile is already in the registry"); + } + + Writer writer = new FileWriter(armyFile.getAbsolutePath()); + writer.write(armyFile.getName()+"\n"); + + // puts all units in a army to a specific list + army.getUnits() + .forEach(unit -> { + try { + writer.write(makeCSVString(unit)); + } catch (IOException e) { + e.printStackTrace(); + } + }); + + writer.close(); + return armyFile; + } + + /** + * method that takes a file and creates an army form its context + * @param armyName the file you are looking for also the name of the army + * @return the new Army created from the file + * @throws IOException any mistakes with the file will throw an exception + */ + public static Army readFromCSV(String armyName) throws IOException { + // finds path to wanted file + Path path = Path.of("src/main/resources/armyFiles/"+armyName); + if(Path.of("src/main/resources/armyFiles/"+armyName).getFileName() == null) throw new NoSuchFileException("File not found"); + + Army newArmy = new Army(armyName); + ArrayList<Unit> newUnits = new ArrayList<>(); + Files.lines(path) + .skip(1) + .forEach(line -> { + //checkForCharacters(line); + checkForUnit(line, newUnits); + }); + if (newUnits.size() == 0){ + throw new NullPointerException("This file doesnt contain any units"); + } + newArmy.addAll(newUnits); + return newArmy; + } + + /** + * method that checks which unitType a line from a file is + * @param line line from a file + * @param newUnits arrayList with the new Units created + */ + public static void checkForUnit(String line, ArrayList<Unit> newUnits){ + String[] column = line.split(","); + if(column.length < 6) throw new IllegalArgumentException("File is not readable"); + + // all 4 different unit types passed to an arraylist of units + String unitType = column[0]; + if(Objects.equals(unitType, "InfantryUnit")){ + newUnits.add(new InfantryUnit(column[1], Integer.parseInt(column[2]), Integer.parseInt(column[2]) + ,Integer.parseInt(column[3]),Integer.parseInt(column[4]))); + } else if(Objects.equals(unitType, "RangedUnit")){ + newUnits.add(new RangedUnit(column[1], Integer.parseInt(column[2]), Integer.parseInt(column[2]) + ,Integer.parseInt(column[3]),Integer.parseInt(column[4]))); + } else if(Objects.equals(unitType, "CavalryUnit")){ + newUnits.add(new CavalryUnit(column[1], Integer.parseInt(column[2]), Integer.parseInt(column[2]) + ,Integer.parseInt(column[3]),Integer.parseInt(column[4]))); + }else if(Objects.equals(unitType, "CommanderUnit")){ + newUnits.add(new CommanderUnit(column[1], Integer.parseInt(column[2]), Integer.parseInt(column[2]) + ,Integer.parseInt(column[3]),Integer.parseInt(column[4]))); + } + } + + /* + public static void checkForCharacters(String lines) throws IllegalArgumentException{ + String removeCharacters = "[\\d]"; + Pattern pt = Pattern.compile(removeCharacters); + Matcher mt = pt.matcher(lines); + boolean result = mt.matches(); + if (result) throw new IllegalArgumentException("Illegal characters found in file"); + } + */ +} \ No newline at end of file diff --git a/src/main/java/GameHub.java b/src/main/java/GameHub.java new file mode 100644 index 0000000000000000000000000000000000000000..b60f6a43d4f33d4858b59c107183bb8581f37418 --- /dev/null +++ b/src/main/java/GameHub.java @@ -0,0 +1,228 @@ +import SpecificUnits.*; +import BattleSimulation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import static javax.swing.JOptionPane.*; + +/** + * this is the client for my warGame + */ +public class GameHub { + + public static List<Unit> unitList = new ArrayList<>(); + public static List<Army> armyList = new ArrayList<>(); + + /** + * the main method that starts the game + * @param args + */ + public static void main(String[] args) { + start(); + } + + public static boolean finished = true; + + /** + * the start f the game, where you can choose what you want to do in the game + */ + public static void start() { + List<Army> armyList = new ArrayList<>(); + while(finished){ + try { + String[] menuInput = + { + "Register new Unit", + "Register new Army", + "Add all units", + "Multiply unit count", + "Remove all units registered", + "Run simulation", + "See all Units", + "End Game", + }; + final int REGISTER_NEW = 0; + final int REGISTER_ARMY = 1; + final int ADD_ALL = 2; + final int MULTIPY_UNIT = 3; + final int REMOVE_ALL = 4; + final int RUN_SIMULATION = 5; + final int SHOW_ALL_UNITS = 6; + final int EXIT = 7; + + int menuSelection = showOptionDialog(null, "****WarGames****" + "\n Choose function", + "Project Idatt2001", YES_NO_OPTION, INFORMATION_MESSAGE, null, menuInput, menuInput[0]); + + switch (menuSelection) { + case REGISTER_NEW -> { + REGISTERNEW(); + } + case REGISTER_ARMY -> { + REGISTERARMY(); + } + case ADD_ALL -> { + ADDALL(); + } + case MULTIPY_UNIT -> { + MULTIPYUNIT(); + } + case REMOVE_ALL -> { + REMOVEALL(); + } + case RUN_SIMULATION -> { + RUNSIMULATION(); + } + case SHOW_ALL_UNITS -> { + SHOWALLUNITS(); + } + + case EXIT -> { + System.out.println(""" + Thanks of using this Game + Bye + """); + finished = false; + } + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + /** + * method where you register new units + */ + private static void REGISTERNEW() { + String typeRead = showInputDialog("what type of unit is it\n" + + "1. Infantry" + + "\n2. Range" + + "\n3. Cavalry" + + "\n4. Commander"); + int type = Integer.parseInt(typeRead); + String newName = showInputDialog("What is the name of the unit"); + String newDamageRead = showInputDialog("How much damage does it deal"); + int newDamage = Integer.parseInt(newDamageRead); + String newArmorRead = showInputDialog("How much Armor does it have"); + int newArmor = Integer.parseInt(newArmorRead); + String newHealthRead = showInputDialog("How much health does it have"); + int newHealth = Integer.parseInt(newHealthRead); + String newMeleeRead = showInputDialog("How much melee damage does it deal"); + int newMelee = Integer.parseInt(newMeleeRead); + + if (type == 1){ + unitList.add(new InfantryUnit(newName, newHealth, newDamage, newArmor, newMelee)); + } + else if(type == 2){ + unitList.add(new RangedUnit(newName, newHealth, newDamage, newArmor, newMelee)); + } + else if(type == 3){ + unitList.add(new CavalryUnit(newName, newHealth, newDamage, newArmor, newMelee)); + } + else if(type == 4){ + unitList.add(new CommanderUnit(newName, newHealth, newDamage, newArmor, newMelee)); + } + + } + + /** + * method for registering new army + */ + private static void REGISTERARMY() { + String newName = showInputDialog("Write the name of the army"); + Army army = new Army(newName); + armyList.add(army); + } + + /** + * method for adding all units to an army + */ + private static void ADDALL() { + String armyName = showInputDialog("what is the name of the army you want to add all these units to"); + for (Army a:armyList) { + if(Objects.equals(a.getName(), armyName)){ + a.addAll(unitList); + } + } + } + + /** + * method for multiplying a specific unit based on type + */ + private static void MULTIPYUNIT() { + String typeRead = showInputDialog("what type of unit is it\n" + + "1. Infantry" + + "\n2. Range" + + "\n3. Cavalry" + + "\n4. Commander"); + int type = Integer.parseInt(typeRead); + + String nameMultiple = showInputDialog("What is the name of unit you want to multiple"); + String howManyTimes = showInputDialog("How many do you want"); + int multipleNum = Integer.parseInt(howManyTimes); + + if (type == 1) { + for (Unit inf : unitList) { + if (Objects.equals(inf.getName(), nameMultiple)) { + for (int i = 0; i <= multipleNum; i++) { + unitList.add(new InfantryUnit(inf.getName(), inf.getHealth(), inf.getAttack(), inf.getArmor(), inf.getMelee())); + } + } + } + } + + else if (type == 2){ + for (Unit rng: unitList) { + if (Objects.equals(rng.getName(), nameMultiple)){ + for (int i = 0; i < multipleNum; i++) { + unitList.add(new RangedUnit(rng.getName(), rng.getHealth(), rng.getAttack(), rng.getArmor(), rng.getMelee())); + } + } + } + } + + else if (type == 3){ + for (Unit cav : unitList){ + if (Objects.equals(cav.getName(), nameMultiple)){ + for (int i = 0; i <= multipleNum; i++) { + unitList.add(new CavalryUnit(cav.getName(), cav.getHealth(), cav.getAttack(), cav.getArmor(), cav.getMelee())); + } + } + } + } + + else if (type == 4){ + for (Unit com : unitList){ + if (Objects.equals(com.getName(), nameMultiple)){ + for (int i = 0; i <= multipleNum; i++) { + unitList.add(new CommanderUnit(com.getName(), com.getHealth(), com.getAttack(), com.getArmor(), com.getMelee())); + } + } + } + } + } + + /** + * remove all units in the list, so you can make a new army + */ + private static void REMOVEALL() { + unitList.clear(); + } + + /** + * mathod that runs the simulation of the battle + */ + private static void RUNSIMULATION() { + Battle battle = new Battle(armyList.get(0), armyList.get(1)); + System.out.println(battle.simulate()); + } + + + /** + * shows all units registered + */ + private static void SHOWALLUNITS() { + System.out.println(unitList); + } + } diff --git a/src/main/java/SpecificUnits/CavalryUnit.java b/src/main/java/SpecificUnits/CavalryUnit.java new file mode 100644 index 0000000000000000000000000000000000000000..c193652f78c84b319cedbd4ae4c99d1065b79687 --- /dev/null +++ b/src/main/java/SpecificUnits/CavalryUnit.java @@ -0,0 +1,58 @@ +package SpecificUnits; + +/** + * Cavalry class that represents the cavalry unit with special features + */ +public class CavalryUnit extends Unit { +private boolean firstCharge = true; + /** + * this is the constructor for all units + * @param name + * @param health + * @param attack damage + * @param armor protection + * @param melee melee damage + * @throws IllegalArgumentException if health sett < 0 or name is empty thr exception + */ + public CavalryUnit(String name, int health, int attack, int armor,int melee) throws IllegalArgumentException { + super(name, health, attack, armor, melee); + } + + /** + * an easier constructor with predefined attack and armor and melee + * @param name + * @param health + * @throws IllegalArgumentException if health sett < 0 or name is empty thr exception + */ + public CavalryUnit(String name, int health) throws IllegalArgumentException { + this(name, health, 20, 12, 2); + } + + + /** + *this method represents the attackBonuses of a cavalry unit + * the first attack of this unit will it will get a charge bonus +3 + * later on it will only have the melee attack as main attackBonus + * @return ether +5 or +2 as a attackBonus, depends on the firstCharge bonus + */ + @Override + int getAttackBonus() { + int charge = 3; + if(firstCharge){ + firstCharge = false; + return this.getMelee() + charge; + } + + return this.getMelee(); + } + + /** + * this unit has a better protection than basic infantry, and has a bonus of +3 to resistance + * @return bonus of 3 as resistance + */ + @Override + int getResistBonus() { + int cavalry = 3; + return cavalry; + } +} diff --git a/src/main/java/SpecificUnits/CommanderUnit.java b/src/main/java/SpecificUnits/CommanderUnit.java new file mode 100644 index 0000000000000000000000000000000000000000..5e16c6fa2a93235a78fbd98fb26703b9e8edaf50 --- /dev/null +++ b/src/main/java/SpecificUnits/CommanderUnit.java @@ -0,0 +1,50 @@ +package SpecificUnits; + +/** + * Commander class that represents all the variables and methods of a commander unit + */ +public class CommanderUnit extends CavalryUnit{ + + /** + * this is the constructor for all units + * @param name + * @param health + * @param attack damage + * @param armor protection + * @param melee melee damage + * @throws IllegalArgumentException if health sett < 0 or name is empty thr exception + */ + public CommanderUnit(String name, int health, int attack, int armor, int melee) throws IllegalArgumentException { + super(name, health, attack, armor, melee); + } + + /** + * an easier constructor with predefined attack and armor + * @param name + * @param health + * @throws IllegalArgumentException if health sett < 0 or name is empty thr exception + */ + public CommanderUnit(String name, int health) throws IllegalArgumentException { + this(name, health, 25, 15, 2); + } + + /** + *this method represents the attackBonuses of a cavalry unit + * the first attack of this unit will it will get a charge bonus +3 + * later on it will only have the melee attack as main attackBonus + * @return ether +5 or +2 as a attackBonus, depends on the firstCharge bonus + */ + @Override + int getAttackBonus() { + return super.getAttackBonus(); + } + + /** + * this unit has a better protection than basic infantry, and has a bonus of +3 to resistance + * @return bonus of 3 as resistance + */ + @Override + int getResistBonus() { + return super.getResistBonus(); + } +} diff --git a/src/main/java/SpecificUnits/InfantryUnit.java b/src/main/java/SpecificUnits/InfantryUnit.java new file mode 100644 index 0000000000000000000000000000000000000000..2e52bec3e591566b94407f111f045d7820ebcb3e --- /dev/null +++ b/src/main/java/SpecificUnits/InfantryUnit.java @@ -0,0 +1,48 @@ +package SpecificUnits; + +/** + * Infantry class that represents all the variables and methods of an infantry unit + */ +public class InfantryUnit extends Unit{ + + /** + * this is the constructor for all units + * @param name + * @param health + * @param attack damage + * @param armor protection + * @param melee melee damage + * @throws IllegalArgumentException if health sett < 0 or name is empty thr exception + */ + public InfantryUnit(String name, int health, int attack, int armor, int melee) throws IllegalArgumentException { + super(name, health, attack, armor, melee); + } + + /** + * a constructor with predefined attack and armor + * @param name + * @param health + * @throws IllegalArgumentException if health sett < 0 or name is empty thr exception + */ + public InfantryUnit(String name, int health) throws IllegalArgumentException { + this(name, health, 15, 10, 2); + } + + /** + * this unit is a melee unit + * @return which means that it gets a +2 as a AttackBonus + */ + @Override + int getAttackBonus() { + return this.getMelee(); + } + + /** + * infantry unit has only a small armor bonus + * @return because of small armor bonus add 1 as a ResistBonus + */ + @Override + int getResistBonus() { + return 1; + } +} diff --git a/src/main/java/SpecificUnits/RangedUnit.java b/src/main/java/SpecificUnits/RangedUnit.java new file mode 100644 index 0000000000000000000000000000000000000000..6c991a8ce25564d91a6dcbaebc4710aff5f07cdb --- /dev/null +++ b/src/main/java/SpecificUnits/RangedUnit.java @@ -0,0 +1,59 @@ +package SpecificUnits; + +/** + * Range class that represents all the variables and methods of a ranger unit + */ +public class RangedUnit extends Unit { + private int distanceDamage = 0; + private int distanceResist = 0; + + /** + * this is the constructor for all units + * @param name + * @param health + * @param attack damage + * @param armor protection + * @param melee melee damage + * @throws IllegalArgumentException if health sett < 0 or name is empty thr exception + */ + public RangedUnit(String name, int health, int attack, int armor, int melee) throws IllegalArgumentException { + super(name, health, attack, armor, melee); + } + + /** + * an easier constructor with predefined attack and armor + * @param name + * @param health + * @throws IllegalArgumentException if health sett < 0 or name is empty thr exception + */ + public RangedUnit(String name, int health) throws IllegalArgumentException { + this(name, health, 15, 8, 2); + } + + /** + * Range unit has a range attack bonus + * @return because this unit is range, this unit gets +3 as AttackBonus + */ + @Override + int getAttackBonus() { + if(distanceDamage >= 3){ + return this.getMelee(); + } + distanceDamage++; + return 3; + } + + /** + * Range units has an uniq resistantBonus that works as distance between him and his opponent + * @return because of this the range unit returns a bonus based on the variable multiplier (distance) + */ + @Override + int getResistBonus() { + int resistBonus = 6 - 2 * distanceResist; + if(resistBonus <= 2){ + resistBonus = 2; + } + distanceResist++; + return resistBonus; + } +} diff --git a/src/main/java/SpecificUnits/Unit.java b/src/main/java/SpecificUnits/Unit.java new file mode 100644 index 0000000000000000000000000000000000000000..9ede60a9d35b67dfdbac4ac26a1a24ca701d6108 --- /dev/null +++ b/src/main/java/SpecificUnits/Unit.java @@ -0,0 +1,134 @@ +package SpecificUnits; + +/** + * SpecificUnits.Unit class that works as a blueprint for all future specific unitclasses + * <p> + * has variables as name, health, DP and CP and to abstract methods + * which talks about bonus Damage or Armor + * </p> + */ +public abstract class Unit { + private String name; + private int health; + private int attack; + private int armor; + private int melee; + + + /** + * this is the constructor for all units + * @param name + * @param health + * @param attack damage + * @param armor protection + * @param melee this is implemented as all my units will be using this melee variable + * @throws IllegalArgumentException if health sett < 0 thr or name is empty exception + */ + public Unit(String name, int health, int attack, int armor, int melee) throws IllegalArgumentException { + if(name.isBlank()){ + throw new IllegalArgumentException("Name no blank bad"); + } + this.name = name; + + if(health < 0){ + throw new IllegalArgumentException("health less zero bad"); + } + this.health = health; + + //I think that attack and armor can be < 0 because in a war something can go wrong or very well + // Eg: a catapult can malfunction, or a units armor can ble less and less efficient + this.attack = attack; + this.armor = armor; + this.melee = melee; + } + + /** + * this is a attack method that takes simulates a unit attacking the opponent + * @param opponent the one this unit attacks + */ + public void attack(Unit opponent){ + int newHealth = opponent.health - (this.attack + this.getAttackBonus()) + (opponent.armor + opponent.getResistBonus()); + if(newHealth < opponent.getHealth()){ + opponent.setHealth(newHealth); + } + } + + /** + * get method for name of the unit + * @return the name of this unit + */ + public String getName() { + return name; + } + + /** + * get method for health of the unit + * @return the health of this unit + */ + public int getHealth() { + return health; + } + + /** + * get method for attacking damage of this unit + * @return the damage or DP of this unit + */ + public int getAttack() { + return attack; + } + + /** + * get method for armor protection of the unit + * @return the protection or AP of this unit + */ + public int getArmor() { + return armor; + } + + /** + * get method for when a unit changes to melee combat + * @return the bonus of using melee + */ + public int getMelee() { + return melee; + } + + /** + * set method that changes the health of a unit if it gets damaged + * @param newHealth the newhealth of this unit after it gets damaged + */ + public void setHealth(int newHealth) { + this.health = newHealth; + } + + /** + * an abstract method for showing an attacking bonus + * <p> + * an abstract method which wil be declared,and further used in subclasses + * </p> + * @return attackBonus as an int + */ + abstract int getAttackBonus(); + + /** + * an abstract method for showing an armor bonus + * <p> + * an abstract method which wil be declared,and further used in subclasses + * </p> + * @return ResistBonus as an int + */ + abstract int getResistBonus(); + + + /** + * a to string method that print out a units statistics in an order + * @return a string of all statistics + */ + @Override + public String toString() { + return "\n\nThe statistics of unit: \n" +name+ + "\nHealth:\n" + health+ + "\nDamage/DP:\n" + attack+ + "\nArmor/AP \n" + armor; + } +} diff --git a/src/main/resources/WarGames_del2/IDATx2001 - Wargames - Del 2.pdf b/src/main/resources/WarGames_del2/IDATx2001 - Wargames - Del 2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..18ca0a5d2b82457f2bc6c89f98a8d4e814f128b4 Binary files /dev/null and b/src/main/resources/WarGames_del2/IDATx2001 - Wargames - Del 2.pdf differ diff --git a/src/main/resources/Wargame_del1/IDATx2001 - Wargames - Del 1.pdf b/src/main/resources/Wargame_del1/IDATx2001 - Wargames - Del 1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cd190a0afec76373aa2a20b7e221882cd1304377 Binary files /dev/null and b/src/main/resources/Wargame_del1/IDATx2001 - Wargames - Del 1.pdf differ diff --git a/src/test/java/BattleSimulation/ArmyTest.java b/src/test/java/BattleSimulation/ArmyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9553ffbdd5ab056984ff34371ec525a6eff9af2a --- /dev/null +++ b/src/test/java/BattleSimulation/ArmyTest.java @@ -0,0 +1,165 @@ +package BattleSimulation; + +import SpecificUnits.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +class ArmyTest { + + public Army armyTest; + + @BeforeEach + void Initiate_army_with_units(){ + String testName = "Human Army"; + armyTest = new Army(testName); + + List<Unit> listTest = new ArrayList<>(); + Unit infantryTest = new InfantryUnit("Knight", 10); + Unit RangeTest = new RangedUnit("Bowmen", 10); + Unit CavalryTest = new CavalryUnit("Rider", 10); + Unit CommanderUnit = new CommanderUnit("Commander", 10); + + listTest.add(infantryTest); + listTest.add(RangeTest); + listTest.add(CavalryTest); + listTest.add(CommanderUnit); + + armyTest.addAll(listTest); + + } + + @Test + void Test_if_constructor_Works_as_expected(){ + Army armyTest = new Army("Human Army"); + assertEquals("Human Army", armyTest.getName()); + } + + @Test + void Test_to_see_if_other_constructor_also_works(){ + ArrayList<Unit> unitList = new ArrayList<>(); + unitList.add(new InfantryUnit("name",1,1,1,1)); + Army armyTest = new Army("Human Army", unitList); + assertEquals(unitList.get(0), armyTest.getUnits().get(0)); + } + + @Test + void getName() { + assertEquals("Human Army", armyTest.getName()); + } + + @Test + void add() { + String testName = "Human Army"; + Army armies = new Army(testName); + + Unit infantryTest = new InfantryUnit("Knight", 10); + armies.add(infantryTest); + + assertEquals(infantryTest,armies.getUnits().get(0)); + } + + @Test + void addAll() { + assertEquals(3, armyTest.getUnits().size()); + } + + @Test + void remove() { + String testName = "Human Army"; + Army armies = new Army(testName); + + Unit infantryTest = new InfantryUnit("Knight", 10); + armies.add(infantryTest); + + armies.remove(infantryTest); + + assertEquals(0,armies.getUnits().size()); + + } + + @Test + void hasUnits() { + assertTrue(armyTest.hasUnits()); + } + + @Test + void getAllUnits() { + assertEquals(2, armyTest.getAllUnits().size()); + } + + @Test + void getRandom() { + assertNotNull(armyTest.getRandom()); + } + + @Nested + public class Test_for_GetMethods_for_different_object_from_one_list { + + @Test + public void Test_if_getInfantry_units_only_has_all_infantry_units_in_a_army(){ + assertTrue(armyTest.getInfantryUnits().get(0) instanceof InfantryUnit); + } + + @Test + public void Test_if_getRange_units_only_has_all_range_units_in_a_army(){ + assertTrue(armyTest.getRangeUnits().get(0) instanceof RangedUnit); + } + + @Test + public void Test_if_getCavalry_units_only_has_all_cavalry_units_in_a_army(){ + assertTrue(armyTest.getCavalryUnits().get(0) instanceof CavalryUnit); + } + + @Test + public void Test_if_getCommander_units_only_has_all_commander_units_in_a_army(){ + assertTrue(armyTest.getCommanderUnits().get(0) instanceof CommanderUnit); + } + + @Test + public void Test_to_see_if_commander_unit_can_be_accessed_from_getCavalryUnits(){ + assertNotEquals(2, armyTest.getCavalryUnits().size()); + } + } + + @Test + void testEquals() { + String testName1 = "Human Army"; + String testName2 = "Orc Army"; + + Army armyTest1 = new Army(testName1); + Army armyTest2 = new Army(testName2); + Army armyTest3 = armyTest1; + Army armyTest4 = new Army(testName1); + + assertNotEquals(armyTest1, armyTest2); + assertTrue(armyTest1.equals(armyTest3)); + assertTrue(armyTest1.equals(armyTest4)); + + } + + @Test + void testHashCode() { + String testName1 = "Human Army"; + String testName2 = "Orc Army"; + + Army armyTest1 = new Army(testName1); + Army armyTest2 = new Army(testName2); + Army armyTest3 = armyTest1; + + assertNotEquals(armyTest1.hashCode(), armyTest2.hashCode()); + assertEquals(armyTest1.hashCode(), armyTest3.hashCode()); + } + + @Test + void testToString() { + String testName1 = "Human Army"; + Army armyTest1 = new Army(testName1); + + assertEquals("Human Army\nunits=[]", armyTest1.toString()); + } +} \ No newline at end of file diff --git a/src/test/java/BattleSimulation/BattleTest.java b/src/test/java/BattleSimulation/BattleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..00060af370b06392e8274362a641a1bd397dc08b --- /dev/null +++ b/src/test/java/BattleSimulation/BattleTest.java @@ -0,0 +1,55 @@ +package BattleSimulation; + +import SpecificUnits.*; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; +class BattleTest { + + @Test + void simulate() { + Army armyTest1 = new Army("A"); + Army armyTest2 = new Army("B"); + Battle battleTest = new Battle(armyTest1, armyTest2); + + List<Unit> listTest1 = new ArrayList<>(); + Unit infantryTest1 = new InfantryUnit("Knight", 10); + Unit RangeTest1 = new RangedUnit("Bowmen", 10); + Unit CavalryTest1 = new CavalryUnit("Rider", 10); + + listTest1.add(infantryTest1); + listTest1.add(RangeTest1); + listTest1.add(CavalryTest1); + + + List<Unit> listTest2 = new ArrayList<>(); + Unit infantryTest2 = new InfantryUnit("Orc", 10); + Unit RangeTest2 = new RangedUnit("Orc crossbow", 10); + Unit CavalryTest2 = new CavalryUnit("Wolf Rider", 10); + + listTest2.add(infantryTest2); + listTest2.add(RangeTest2); + listTest2.add(CavalryTest2); + + + armyTest1.addAll(listTest1); + armyTest2.addAll(listTest2); + + String result = battleTest.simulate().toString(); + System.out.println(result); + } + + @Test + void testToString() { + Army test1 = new Army("A"); + Army test2 = new Army("B"); + Battle battle = new Battle(test1, test2); + battle.whoStarts(); + + assertEquals("A\n[]\n\nB\n[]", battle.toString()); + } +} + diff --git a/src/test/java/BattleSimulation/armyFilesTest.java b/src/test/java/BattleSimulation/armyFilesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b3fdef535b5ab234487185fb052eb9bfd0ee95d0 --- /dev/null +++ b/src/test/java/BattleSimulation/armyFilesTest.java @@ -0,0 +1,101 @@ +package BattleSimulation; + +import SpecificUnits.InfantryUnit; +import SpecificUnits.RangedUnit; +import SpecificUnits.Unit; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.IOException; +import java.nio.file.NoSuchFileException; +import static org.junit.jupiter.api.Assertions.*; + +public class armyFilesTest { + + @Test + public void Test_if_createCSVString_creates_string_of_a_Unit(){ + Unit InfantryTest = new InfantryUnit("Footman", 10); + assertEquals("InfantryUnit,Footman,10,15,10,2"+"\n", armyFiles.makeCSVString(InfantryTest)); + } + + //TODO: check for corrupt files + + @Nested + public class Test_makeCVSFile_method_and_exceptions { + + @Test + public void Test_if_makeCSVFile_makes_a_file_in_armyFile_in_CSV_format() throws IOException { + Unit InfantryTest = new InfantryUnit("Footman", 10); + Unit RangeTest = new RangedUnit("Bowman", 10); + Army armyTest = new Army("Human Army"); + armyTest.add(InfantryTest); + armyTest.add(RangeTest); + + File file = armyFiles.makeCSVFile(armyTest); + assertNotNull(file); + file.delete(); + } + + @Test + public void Test_if_makeCVSFile_throws_IllegalArgumentException_when_a_file_already_exists(){ + Army armyFileExisting = new Army("ExsistingFiletest"); + assertThrows(IllegalArgumentException.class, () -> { + armyFiles.makeCSVFile(armyFileExisting); + }); + } + } + + @Nested + public class Test_readFromCVS_method_and_exceptions{ + + @Test + public void Test_if_readFromCSV_creates_a_army_of_a_wanted_file() throws IOException { + Army armyFileTest = armyFiles.readFromCSV("HumanArmyTest"); + assertEquals(2, armyFileTest.getUnits().size()); + } + + @Test + public void Test_if_readFromCSV_throws_IO_exception(){ + assertThrows(IOException.class, () -> { + armyFiles.readFromCSV(""); + }); + } + + @Test + public void Test_if_readFromCSV_throws_NullPointerException_when_file_has_no_units(){ + assertThrows(NullPointerException.class, () -> { + armyFiles.readFromCSV("NullArmyTest"); + }); + } + + @Test + public void Test_if_readFromCSV_throws_IllegalArgumentException_when_file_not_readable(){ + assertThrows(IllegalArgumentException.class, () -> { + armyFiles.readFromCSV("NotReadableFile"); + }); + } + + @Test + public void Test_if_readFromCSV_throws_NoSuchFileException_when_a_file_doenst_exits(){ + assertThrows(NoSuchFileException.class, () -> { + armyFiles.readFromCSV("NoFileExist"); + }); + } + + @Test + public void Test_if_file_has_units_and_throws_if_not(){ + assertThrows(NullPointerException.class, () -> { + armyFiles.readFromCSV("NullArmyTest"); + }); + } + + /* + @Test + public void Test_if_file_is_corrupt_or_has_illegal_characters_throw_IllegalArgumentException(){ + assertThrows(IllegalArgumentException.class, () -> { + armyFiles.readFromCSV("IllegalCharacters"); + }); + } + */ + } +} diff --git a/src/test/java/SpecificUnits/CavalryUnitTest.java b/src/test/java/SpecificUnits/CavalryUnitTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f883fa52330c4a007cb7ab1be46f5352e14b40ed --- /dev/null +++ b/src/test/java/SpecificUnits/CavalryUnitTest.java @@ -0,0 +1,114 @@ +package SpecificUnits; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class CavalryUnitTest { + + @Test + void attack() { + Unit test1 = new Unit("Rider", 0, 1, 0, 0) { + @Override + int getAttackBonus() { + return 0; + } + + @Override + int getResistBonus() { + return 0; + } + }; + Unit test2 = new Unit("Knight", 10, 0, 0, 0) { + @Override + int getAttackBonus() { + return 0; + } + + @Override + int getResistBonus() { + return 0; + } + }; + + test1.attack(test2); + + assertEquals(9, test2.getHealth()); + } + + @Test + void getName() { + Unit test = new CavalryUnit("Rider",10); + assertEquals("Rider",test.getName()); + } + + @Test + void getHealth() { + Unit test = new CavalryUnit("Rider",1); + assertEquals(1,test.getHealth()); + } + + @Test + void getAttack() { + Unit test = new CavalryUnit("Rider",1,2,3,4); + assertEquals(2,test.getAttack()); + } + + @Test + void getArmor() { + Unit test = new CavalryUnit("Rider",1,2,3,4); + assertEquals(3,test.getArmor()); + } + + @Test + void getMelee() { + Unit test = new CavalryUnit("Rider",1,2,3,4); + assertEquals(4,test.getMelee()); + } + + @Test + void setHealth() { + Unit test = new CavalryUnit("Rider",1,2,3,4); + test.setHealth(2); + assertEquals(2,test.getHealth()); + } + + @Test + void testToString() { + Unit test = new CavalryUnit("Rider",1,2,3,4); + assertEquals("\n\n"+ """ + The statistics of unit:\s + Rider + Health: + 1 + Damage/DP: + 2 + Armor/AP\s + 3""",test.toString()); + } + + @Test + void getAttackBonus() { + Unit test1 = new CavalryUnit("Rider",0,2,0,2); + Unit test2 = new InfantryUnit("Knight",20,0,0,0); + + test1.attack(test2); + test1.attack(test2); + test1.attack(test2); + +//test alle + assertEquals(8, test2.getHealth()); + } + + @Test + void getResistBonus() { + Unit test1 = new CavalryUnit("Rider",10,0,0,0); + Unit test2 = new InfantryUnit("Knight",0,2,0,2); + + test2.attack(test1); + test2.attack(test1); + + assertEquals(8, test1.getHealth()); + + } +} \ No newline at end of file diff --git a/src/test/java/SpecificUnits/CommanderUnitTest.java b/src/test/java/SpecificUnits/CommanderUnitTest.java new file mode 100644 index 0000000000000000000000000000000000000000..58397e8cb393da28703823981f8d017914d322b7 --- /dev/null +++ b/src/test/java/SpecificUnits/CommanderUnitTest.java @@ -0,0 +1,113 @@ +package SpecificUnits; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class CommanderUnitTest { + @Test + void attack() { + Unit test1 = new Unit("Commander", 0, 1, 0, 0) { + @Override + int getAttackBonus() { + return 0; + } + + @Override + int getResistBonus() { + return 0; + } + }; + Unit test2 = new Unit("Knight", 10, 0, 0, 0) { + @Override + int getAttackBonus() { + return 0; + } + + @Override + int getResistBonus() { + return 0; + } + }; + + test1.attack(test2); + + assertEquals(9, test2.getHealth()); + } + + @Test + void getName() { + Unit test = new CommanderUnit("Commander",10); + assertEquals("Commander",test.getName()); + } + + @Test + void getHealth() { + Unit test = new CommanderUnit("Commander",1); + assertEquals(1,test.getHealth()); + } + + @Test + void getAttack() { + Unit test = new CommanderUnit("Commander",1,2,3,4); + assertEquals(2,test.getAttack()); + } + + @Test + void getArmor() { + Unit test = new CavalryUnit("Rider",1,2,3,4); + assertEquals(3,test.getArmor()); + } + + @Test + void getMelee() { + Unit test = new CommanderUnit("Commander",1,2,3,4); + assertEquals(4,test.getMelee()); + } + + @Test + void setHealth() { + Unit test = new CommanderUnit("Commander",1,2,3,4); + test.setHealth(2); + assertEquals(2,test.getHealth()); + } + + @Test + void testToString() { + Unit test = new CommanderUnit("Commander",1,2,3,4); + assertEquals("\n\n"+ """ + The statistics of unit:\s + Commander + Health: + 1 + Damage/DP: + 2 + Armor/AP\s + 3""",test.toString()); + } + + @Test + void getAttackBonus() { + Unit test1 = new CommanderUnit("Commander",0,2,0,2); + Unit test2 = new InfantryUnit("Knight",20,0,0,0); + + test1.attack(test2); + test1.attack(test2); + test1.attack(test2); + + + assertEquals(8, test2.getHealth()); + } + + @Test + void getResistBonus() { + Unit test1 = new CommanderUnit("Commander",10,0,0,0); + Unit test2 = new InfantryUnit("Knight",0,2,0,2); + + test2.attack(test1); + test2.attack(test1); + + assertEquals(8, test1.getHealth()); + + } +} \ No newline at end of file diff --git a/src/test/java/SpecificUnits/InfantryUnitTest.java b/src/test/java/SpecificUnits/InfantryUnitTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4838edbc152bfca5ffc8b79b5247f931166ade80 --- /dev/null +++ b/src/test/java/SpecificUnits/InfantryUnitTest.java @@ -0,0 +1,109 @@ +package SpecificUnits; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class InfantryUnitTest { + + @Test + void attack() { + Unit test1 = new Unit("knight",0, 1, 0, 0) { + @Override + int getAttackBonus() { + return 0; + } + + @Override + int getResistBonus() { + return 0; + } + }; + Unit test2 = new Unit("Orc", 10, 0, 0, 0) { + @Override + int getAttackBonus() { + return 0; + } + + @Override + int getResistBonus() { + return 0; + } + }; + + test1.attack(test2); + assertEquals(9, test2.getHealth()); + + } + + @Test + void getName() { + Unit test = new InfantryUnit("Knight",10); + assertEquals("Knight",test.getName()); + } + + @Test + void getHealth() { + Unit test = new InfantryUnit("Knight", 10); + assertEquals(10,test.getHealth()); + } + + @Test + void getAttack() { + Unit test = new InfantryUnit("knight",1,2,3,4); + assertEquals(2,test.getAttack()); + } + + @Test + void getArmor() { + Unit test = new InfantryUnit("knight",1,2,3,4); + assertEquals(3,test.getArmor()); + } + + @Test + void getMelee() { + Unit test = new InfantryUnit("knight",1,2,3,4); + assertEquals(4,test.getMelee()); + } + + @Test + void setHealth() { + Unit test = new InfantryUnit("knight",1,2,3,4); + test.setHealth(10); + assertEquals(10,test.getHealth()); + } + + @Test + void testToString() { + Unit test = new InfantryUnit("knight",1,2,3,4); + assertEquals("\n\n"+ """ + The statistics of unit:\s + knight + Health: + 1 + Damage/DP: + 2 + Armor/AP\s + 3""",test.toString()); + } + + @Test + void getAttackBonus() { + Unit test1 = new InfantryUnit("knight",1,0,0,2); + Unit test2 = new InfantryUnit("Orc",10,0,0,0); + + test1.attack(test2); + + assertEquals(9, test2.getHealth()); + } + + @Test + void getResistBonus() { + Unit test1 = new InfantryUnit("knight",1,0,0,2); + Unit test2 = new InfantryUnit("Orc",10,0,0,0); + + test1.attack(test2); + + assertEquals(9, test2.getHealth()); + } +} \ No newline at end of file diff --git a/src/test/java/SpecificUnits/RangedUnitTest.java b/src/test/java/SpecificUnits/RangedUnitTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fefe9ab4bdb68787fbd72fcd23bb9d9ef782c4e4 --- /dev/null +++ b/src/test/java/SpecificUnits/RangedUnitTest.java @@ -0,0 +1,118 @@ +package SpecificUnits; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class RangedUnitTest { + + @Test + void attack() { + Unit test1 = new Unit("Bowman", 10, 1, 0, 0) { + @Override + int getAttackBonus() { + return 0; + } + + @Override + int getResistBonus() { + return 0; + } + }; + Unit test2 = new Unit("Knight", 10, 0, 0, 0) { + @Override + int getAttackBonus() { + return 0; + } + + @Override + int getResistBonus() { + return 0; + } + }; + + test1.attack(test2); + + assertEquals(9, test2.getHealth()); + } + + @Test + void getName() { + Unit test = new RangedUnit("Bowmen",10); + assertEquals("Bowmen",test.getName()); + } + + @Test + void getHealth() { + Unit test = new RangedUnit("Bowmen",1); + assertEquals(1,test.getHealth()); + } + + @Test + void getAttack() { + Unit test = new RangedUnit("Bowmen",1,2,3,4); + assertEquals(2,test.getAttack()); + } + + @Test + void getArmor() { + Unit test = new RangedUnit("Bowmen",1,2,3,4); + assertEquals(3,test.getArmor()); + } + + @Test + void getMelee() { + Unit test = new RangedUnit("Bowmen",1,2,3,4); + assertEquals(4,test.getMelee()); + } + + @Test + void setHealth() { + Unit test = new RangedUnit("Bowmen",1,2,3,4); + test.setHealth(2); + assertEquals(2,test.getHealth()); + } + + @Test + void testToString() { + Unit test = new RangedUnit("Bowmen",1,2,3,4); + assertEquals("\n\n"+ """ + The statistics of unit:\s + Bowmen + Health: + 1 + Damage/DP: + 2 + Armor/AP\s + 3""",test.toString()); + } + + @Test + void getAttackBonus() { + Unit test1 = new RangedUnit("Bowman",10,2,1,1); + Unit test2 = new InfantryUnit("Knight",20,1,1,1); + + test1.attack(test2); + test1.attack(test2); + test1.attack(test2); + test1.attack(test2); + test1.attack(test2); + + assertEquals(9, test2.getHealth()); + } + + @Test + void getResistBonus() { + Unit test1 = new RangedUnit("Bowman",15,0,0,0); + Unit test2 = new InfantryUnit("Knight",0,3,0,2); + + test2.attack(test1); + test2.attack(test1); + test2.attack(test1); + test2.attack(test1); + test2.attack(test1); + + assertEquals(5, test1.getHealth()); + + } +} \ No newline at end of file diff --git a/src/test/java/UnitTest.java b/src/test/java/UnitTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fae3f6d59963db4d403a8d5e747b5f148f42ea5d --- /dev/null +++ b/src/test/java/UnitTest.java @@ -0,0 +1,79 @@ +import SpecificUnits.*; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +/** + * A unit test class that tests all war units, and the unit blueprint + */ + +public class UnitTest{ + + @Test + public void Test_Exception_Thrown_IfName_Is_Blank() { + try { + Unit unit = new InfantryUnit("", 12); + fail("This constructor should throw an IllegalArgumentException"); + } catch (IllegalArgumentException e) { + assertTrue(true); + } + } + + @Test + public void Test_Exception_Thrown_If_Health_Is_Less_Than_Zero() { + try { + Unit unit = new InfantryUnit("Knights", -1); + + } catch (IllegalArgumentException e) { + assertTrue(true); + } + } + + @Test + public void Test_If_Constructor_works_For_Infantry () { + Unit InfantryTest = new InfantryUnit("Test",1,1,1,1); + assertNotNull(InfantryTest); + } + + + @Test + public void Test_If_Constructor_works_For_Range () { + Unit RangeTest = new RangedUnit("Test",1,1,1,1); + assertNotNull(RangeTest); + } + + @Test + public void Test_If_Constructor_works_For_Cavalry () { + Unit CavalryTest = new CavalryUnit("Test",1,1,1,1); + assertNotNull(CavalryTest); + } + + @Test + public void Test_If_Constructor_works_For_Commander () { + Unit CommanderTest = new CommanderUnit("Test",1,1,1,1); + assertNotNull(CommanderTest); + } + + @Test + public void Test_If_Constructor_works_For_Infantry_Easier_Constructor () { + Unit InfantryTest = new InfantryUnit("Test",1); + assertNotNull(InfantryTest); + } + + @Test + public void Test_If_Constructor_works_For_Range_Easier_Constructor () { + Unit RangeTest = new RangedUnit("Test",1); + assertNotNull(RangeTest); + } + @Test + public void Test_If_Constructor_works_For_Cavalry_Easier_Constructor () { + Unit CavalryTest = new CavalryUnit("Test",1); + assertNotNull(CavalryTest); + } + + @Test + public void Test_If_Constructor_works_For_Commander_Easier_Constructor () { + Unit CommanderTest = new CommanderUnit("Test",1,1,1,1); + assertNotNull(CommanderTest); + } +} diff --git a/target/classes/BattleSimulation/Army.class b/target/classes/BattleSimulation/Army.class new file mode 100644 index 0000000000000000000000000000000000000000..1eb614d9fe057bc6483d62cea7614204a3778c64 Binary files /dev/null and b/target/classes/BattleSimulation/Army.class differ diff --git a/target/classes/BattleSimulation/Battle.class b/target/classes/BattleSimulation/Battle.class new file mode 100644 index 0000000000000000000000000000000000000000..84c236978ceb8c86bd7d6e59c40b5428632c707c Binary files /dev/null and b/target/classes/BattleSimulation/Battle.class differ diff --git a/target/classes/GameHub.class b/target/classes/GameHub.class new file mode 100644 index 0000000000000000000000000000000000000000..becd7795a44730590d1fe66f4e074165df95feba Binary files /dev/null and b/target/classes/GameHub.class differ diff --git a/target/classes/SpecificUnits/CavalryUnit.class b/target/classes/SpecificUnits/CavalryUnit.class new file mode 100644 index 0000000000000000000000000000000000000000..5a1e42c8be079303f36e34e0712bf5297c1d8655 Binary files /dev/null and b/target/classes/SpecificUnits/CavalryUnit.class differ diff --git a/target/classes/SpecificUnits/CommanderUnit.class b/target/classes/SpecificUnits/CommanderUnit.class new file mode 100644 index 0000000000000000000000000000000000000000..0adaadc29b5decdb498384c36b94672b53a49e5e Binary files /dev/null and b/target/classes/SpecificUnits/CommanderUnit.class differ diff --git a/target/classes/SpecificUnits/InfantryUnit.class b/target/classes/SpecificUnits/InfantryUnit.class new file mode 100644 index 0000000000000000000000000000000000000000..1f32f20e08905e31baf0a61deab34ff681e40893 Binary files /dev/null and b/target/classes/SpecificUnits/InfantryUnit.class differ diff --git a/target/classes/SpecificUnits/RangedUnit.class b/target/classes/SpecificUnits/RangedUnit.class new file mode 100644 index 0000000000000000000000000000000000000000..fc1d3795d58cef462b8255719343603b47cf306f Binary files /dev/null and b/target/classes/SpecificUnits/RangedUnit.class differ diff --git a/target/classes/SpecificUnits/Unit.class b/target/classes/SpecificUnits/Unit.class new file mode 100644 index 0000000000000000000000000000000000000000..77c981605105c251fcda831b2b72b91e444e8cb0 Binary files /dev/null and b/target/classes/SpecificUnits/Unit.class differ diff --git a/target/classes/Wargame_del1/IDATx2001 - Wargames - Del 1.pdf b/target/classes/Wargame_del1/IDATx2001 - Wargames - Del 1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cd190a0afec76373aa2a20b7e221882cd1304377 Binary files /dev/null and b/target/classes/Wargame_del1/IDATx2001 - Wargames - Del 1.pdf differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..f702cc3287fb1ad3325a79cd13783c668d06bb20 --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Mon Feb 21 13:41:53 CET 2022 +groupId=edu.ntnu.idatt2001.Project +artifactId=wargame +version=0.1-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..e53062e3ff988d75b7d39af6556ad1eefb81c550 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,8 @@ +SpecificUnits\InfantryUnit.class +BattleSimulation\Army.class +BattleSimulation\Battle.class +SpecificUnits\CavalryUnit.class +SpecificUnits\RangedUnit.class +GameHub.class +SpecificUnits\Unit.class +SpecificUnits\CommanderUnit.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..b2fb897c440d4cb89dc3ab4eac3e0ba8aac8e3af --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,8 @@ +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\main\java\BattleSimulation\Battle.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\main\java\SpecificUnits\CavalryUnit.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\main\java\BattleSimulation\Army.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\main\java\SpecificUnits\Unit.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\main\java\SpecificUnits\InfantryUnit.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\main\java\SpecificUnits\RangedUnit.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\main\java\SpecificUnits\CommanderUnit.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\main\java\GameHub.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..be2df5ead189be3073ca28d0f5ac3f299f9be9fe --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1,15 @@ +SpecificUnits\CommanderUnitTest$2.class +SpecificUnits\RangedUnitTest$1.class +SpecificUnits\RangedUnitTest$2.class +SpecificUnits\CavalryUnitTest$2.class +SpecificUnits\CommanderUnitTest$1.class +UnitTest.class +SpecificUnits\RangedUnitTest.class +SpecificUnits\InfantryUnitTest$1.class +SpecificUnits\InfantryUnitTest$2.class +SpecificUnits\CavalryUnitTest$1.class +SpecificUnits\CommanderUnitTest.class +BattleSimulation\ArmyTest.class +BattleSimulation\BattleTest.class +SpecificUnits\CavalryUnitTest.class +SpecificUnits\InfantryUnitTest.class diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..05917260c04c692e74588237faa33ecb91020762 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1,7 @@ +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\test\java\BattleSimulation\BattleTest.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\test\java\SpecificUnits\CommanderUnitTest.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\test\java\BattleSimulation\ArmyTest.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\test\java\UnitTest.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\test\java\SpecificUnits\InfantryUnitTest.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\test\java\SpecificUnits\RangedUnitTest.java +C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\src\test\java\SpecificUnits\CavalryUnitTest.java diff --git a/target/surefire-reports/BattleSimulation.ArmyTest.txt b/target/surefire-reports/BattleSimulation.ArmyTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c0d7018818585f65e7a5f4ceb1209664499d4f4 --- /dev/null +++ b/target/surefire-reports/BattleSimulation.ArmyTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: BattleSimulation.ArmyTest +------------------------------------------------------------------------------- +Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.038 s - in BattleSimulation.ArmyTest diff --git a/target/surefire-reports/BattleSimulation.BattleTest.txt b/target/surefire-reports/BattleSimulation.BattleTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..5abeb1c97ffe8c48e33369a62ba28d0aaa2185b8 --- /dev/null +++ b/target/surefire-reports/BattleSimulation.BattleTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: BattleSimulation.BattleTest +------------------------------------------------------------------------------- +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in BattleSimulation.BattleTest diff --git a/target/surefire-reports/SpecificUnits.CavalryUnitTest.txt b/target/surefire-reports/SpecificUnits.CavalryUnitTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..035d2cf947347611216b2ac6a990d36de0f657e3 --- /dev/null +++ b/target/surefire-reports/SpecificUnits.CavalryUnitTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: SpecificUnits.CavalryUnitTest +------------------------------------------------------------------------------- +Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007 s - in SpecificUnits.CavalryUnitTest diff --git a/target/surefire-reports/SpecificUnits.CommanderUnitTest.txt b/target/surefire-reports/SpecificUnits.CommanderUnitTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2ee727cb6308c65694cdfd9ac014c8a568968d8 --- /dev/null +++ b/target/surefire-reports/SpecificUnits.CommanderUnitTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: SpecificUnits.CommanderUnitTest +------------------------------------------------------------------------------- +Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 s - in SpecificUnits.CommanderUnitTest diff --git a/target/surefire-reports/SpecificUnits.InfantryUnitTest.txt b/target/surefire-reports/SpecificUnits.InfantryUnitTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9f1da7fed24c98c330d2dddf749131d373a0fc2 --- /dev/null +++ b/target/surefire-reports/SpecificUnits.InfantryUnitTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: SpecificUnits.InfantryUnitTest +------------------------------------------------------------------------------- +Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in SpecificUnits.InfantryUnitTest diff --git a/target/surefire-reports/SpecificUnits.RangedUnitTest.txt b/target/surefire-reports/SpecificUnits.RangedUnitTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ce0162eb827741b169e57c1b45d461ac325cb97 --- /dev/null +++ b/target/surefire-reports/SpecificUnits.RangedUnitTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: SpecificUnits.RangedUnitTest +------------------------------------------------------------------------------- +Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 s - in SpecificUnits.RangedUnitTest diff --git a/target/surefire-reports/TEST-BattleSimulation.ArmyTest.xml b/target/surefire-reports/TEST-BattleSimulation.ArmyTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..f08bc3892d6414ac00d2520a93e4a80ecadc1e40 --- /dev/null +++ b/target/surefire-reports/TEST-BattleSimulation.ArmyTest.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="BattleSimulation.ArmyTest" time="0.038" tests="10" errors="0" skipped="0" failures="0"> + <properties> + <property name="java.specification.version" value="16"/> + <property name="sun.cpu.isalist" value="amd64"/> + <property name="sun.jnu.encoding" value="Cp1252"/> + <property name="java.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="java.vm.vendor" value="Oracle Corporation"/> + <property name="sun.arch.data.model" value="64"/> + <property name="user.variant" value=""/> + <property name="java.vendor.url" value="https://java.oracle.com/"/> + <property name="user.timezone" value="Europe/Oslo"/> + <property name="os.name" value="Windows 10"/> + <property name="java.vm.specification.version" value="16"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="user.country" value="NO"/> + <property name="sun.boot.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin"/> + <property name="sun.java.command" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar C:\Users\Administrator\AppData\Local\Temp\surefire5581609503519300717 2022-02-21T13-41-52_107-jvmRun1 surefire13063935482054520860tmp surefire_06238391663110193232tmp"/> + <property name="jdk.debug" value="release"/> + <property name="surefire.test.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="sun.cpu.endian" value="little"/> + <property name="user.home" value="C:\Users\Administrator"/> + <property name="user.language" value="no"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="java.version.date" value="2021-07-20"/> + <property name="java.home" value="C:\Program Files\Java\jdk-16.0.2"/> + <property name="file.separator" value="\"/> + <property name="basedir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="java.vm.compressedOopsMode" value="32-bit"/> + <property name="line.separator" value=" "/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="surefire.real.class.path" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar"/> + <property name="user.script" value=""/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="java.runtime.version" value="16.0.2+7-67"/> + <property name="user.name" value="Administrator"/> + <property name="path.separator" value=";"/> + <property name="os.version" value="10.0"/> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + <property name="file.encoding" value="Cp1252"/> + <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/> + <property name="localRepository" value="C:\Users\Administrator\.m2\repository"/> + <property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/> + <property name="java.io.tmpdir" value="C:\Users\ADMINI~1\AppData\Local\Temp\"/> + <property name="idea.version" value="2021.2.2"/> + <property name="java.version" value="16.0.2"/> + <property name="user.dir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="os.arch" value="amd64"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="sun.os.patch.level" value=""/> + <property name="java.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\Documents\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Local\GitHubDesktop\bin;."/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.vendor" value="Oracle Corporation"/> + <property name="java.vm.version" value="16.0.2+7-67"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="java.class.version" value="60.0"/> + </properties> + <testcase name="addAll" classname="BattleSimulation.ArmyTest" time="0.017"/> + <testcase name="testToString" classname="BattleSimulation.ArmyTest" time="0.007"/> + <testcase name="remove" classname="BattleSimulation.ArmyTest" time="0"/> + <testcase name="getAllUnits" classname="BattleSimulation.ArmyTest" time="0"/> + <testcase name="getName" classname="BattleSimulation.ArmyTest" time="0"/> + <testcase name="add" classname="BattleSimulation.ArmyTest" time="0"/> + <testcase name="hasUnits" classname="BattleSimulation.ArmyTest" time="0.002"/> + <testcase name="getRandom" classname="BattleSimulation.ArmyTest" time="0.001"/> + <testcase name="testHashCode" classname="BattleSimulation.ArmyTest" time="0.001"/> + <testcase name="testEquals" classname="BattleSimulation.ArmyTest" time="0.001"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/TEST-BattleSimulation.BattleTest.xml b/target/surefire-reports/TEST-BattleSimulation.BattleTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..17b61856915b612b0fb4e181c3ce981934daf6df --- /dev/null +++ b/target/surefire-reports/TEST-BattleSimulation.BattleTest.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="BattleSimulation.BattleTest" time="0.003" tests="2" errors="0" skipped="0" failures="0"> + <properties> + <property name="java.specification.version" value="16"/> + <property name="sun.cpu.isalist" value="amd64"/> + <property name="sun.jnu.encoding" value="Cp1252"/> + <property name="java.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="java.vm.vendor" value="Oracle Corporation"/> + <property name="sun.arch.data.model" value="64"/> + <property name="user.variant" value=""/> + <property name="java.vendor.url" value="https://java.oracle.com/"/> + <property name="user.timezone" value="Europe/Oslo"/> + <property name="os.name" value="Windows 10"/> + <property name="java.vm.specification.version" value="16"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="user.country" value="NO"/> + <property name="sun.boot.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin"/> + <property name="sun.java.command" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar C:\Users\Administrator\AppData\Local\Temp\surefire5581609503519300717 2022-02-21T13-41-52_107-jvmRun1 surefire13063935482054520860tmp surefire_06238391663110193232tmp"/> + <property name="jdk.debug" value="release"/> + <property name="surefire.test.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="sun.cpu.endian" value="little"/> + <property name="user.home" value="C:\Users\Administrator"/> + <property name="user.language" value="no"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="java.version.date" value="2021-07-20"/> + <property name="java.home" value="C:\Program Files\Java\jdk-16.0.2"/> + <property name="file.separator" value="\"/> + <property name="basedir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="java.vm.compressedOopsMode" value="32-bit"/> + <property name="line.separator" value=" "/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="surefire.real.class.path" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar"/> + <property name="user.script" value=""/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="java.runtime.version" value="16.0.2+7-67"/> + <property name="user.name" value="Administrator"/> + <property name="path.separator" value=";"/> + <property name="os.version" value="10.0"/> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + <property name="file.encoding" value="Cp1252"/> + <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/> + <property name="localRepository" value="C:\Users\Administrator\.m2\repository"/> + <property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/> + <property name="java.io.tmpdir" value="C:\Users\ADMINI~1\AppData\Local\Temp\"/> + <property name="idea.version" value="2021.2.2"/> + <property name="java.version" value="16.0.2"/> + <property name="user.dir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="os.arch" value="amd64"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="sun.os.patch.level" value=""/> + <property name="java.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\Documents\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Local\GitHubDesktop\bin;."/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.vendor" value="Oracle Corporation"/> + <property name="java.vm.version" value="16.0.2+7-67"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="java.class.version" value="60.0"/> + </properties> + <testcase name="testToString" classname="BattleSimulation.BattleTest" time="0"/> + <testcase name="simulate" classname="BattleSimulation.BattleTest" time="0.003"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/TEST-SpecificUnits.CavalryUnitTest.xml b/target/surefire-reports/TEST-SpecificUnits.CavalryUnitTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..f8d7757533a90fb783556ddcb932b7efe8c8f447 --- /dev/null +++ b/target/surefire-reports/TEST-SpecificUnits.CavalryUnitTest.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="SpecificUnits.CavalryUnitTest" time="0.007" tests="10" errors="0" skipped="0" failures="0"> + <properties> + <property name="java.specification.version" value="16"/> + <property name="sun.cpu.isalist" value="amd64"/> + <property name="sun.jnu.encoding" value="Cp1252"/> + <property name="java.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="java.vm.vendor" value="Oracle Corporation"/> + <property name="sun.arch.data.model" value="64"/> + <property name="user.variant" value=""/> + <property name="java.vendor.url" value="https://java.oracle.com/"/> + <property name="user.timezone" value="Europe/Oslo"/> + <property name="os.name" value="Windows 10"/> + <property name="java.vm.specification.version" value="16"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="user.country" value="NO"/> + <property name="sun.boot.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin"/> + <property name="sun.java.command" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar C:\Users\Administrator\AppData\Local\Temp\surefire5581609503519300717 2022-02-21T13-41-52_107-jvmRun1 surefire13063935482054520860tmp surefire_06238391663110193232tmp"/> + <property name="jdk.debug" value="release"/> + <property name="surefire.test.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="sun.cpu.endian" value="little"/> + <property name="user.home" value="C:\Users\Administrator"/> + <property name="user.language" value="no"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="java.version.date" value="2021-07-20"/> + <property name="java.home" value="C:\Program Files\Java\jdk-16.0.2"/> + <property name="file.separator" value="\"/> + <property name="basedir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="java.vm.compressedOopsMode" value="32-bit"/> + <property name="line.separator" value=" "/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="surefire.real.class.path" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar"/> + <property name="user.script" value=""/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="java.runtime.version" value="16.0.2+7-67"/> + <property name="user.name" value="Administrator"/> + <property name="path.separator" value=";"/> + <property name="os.version" value="10.0"/> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + <property name="file.encoding" value="Cp1252"/> + <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/> + <property name="localRepository" value="C:\Users\Administrator\.m2\repository"/> + <property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/> + <property name="java.io.tmpdir" value="C:\Users\ADMINI~1\AppData\Local\Temp\"/> + <property name="idea.version" value="2021.2.2"/> + <property name="java.version" value="16.0.2"/> + <property name="user.dir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="os.arch" value="amd64"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="sun.os.patch.level" value=""/> + <property name="java.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\Documents\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Local\GitHubDesktop\bin;."/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.vendor" value="Oracle Corporation"/> + <property name="java.vm.version" value="16.0.2+7-67"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="java.class.version" value="60.0"/> + </properties> + <testcase name="attack" classname="SpecificUnits.CavalryUnitTest" time="0.001"/> + <testcase name="getAttackBonus" classname="SpecificUnits.CavalryUnitTest" time="0"/> + <testcase name="testToString" classname="SpecificUnits.CavalryUnitTest" time="0"/> + <testcase name="getName" classname="SpecificUnits.CavalryUnitTest" time="0.001"/> + <testcase name="setHealth" classname="SpecificUnits.CavalryUnitTest" time="0.001"/> + <testcase name="getAttack" classname="SpecificUnits.CavalryUnitTest" time="0"/> + <testcase name="getHealth" classname="SpecificUnits.CavalryUnitTest" time="0"/> + <testcase name="getResistBonus" classname="SpecificUnits.CavalryUnitTest" time="0.001"/> + <testcase name="getArmor" classname="SpecificUnits.CavalryUnitTest" time="0"/> + <testcase name="getMelee" classname="SpecificUnits.CavalryUnitTest" time="0.001"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/TEST-SpecificUnits.CommanderUnitTest.xml b/target/surefire-reports/TEST-SpecificUnits.CommanderUnitTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..5c54d91095e4a451b91947b7d63bea4df462e972 --- /dev/null +++ b/target/surefire-reports/TEST-SpecificUnits.CommanderUnitTest.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="SpecificUnits.CommanderUnitTest" time="0.006" tests="10" errors="0" skipped="0" failures="0"> + <properties> + <property name="java.specification.version" value="16"/> + <property name="sun.cpu.isalist" value="amd64"/> + <property name="sun.jnu.encoding" value="Cp1252"/> + <property name="java.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="java.vm.vendor" value="Oracle Corporation"/> + <property name="sun.arch.data.model" value="64"/> + <property name="user.variant" value=""/> + <property name="java.vendor.url" value="https://java.oracle.com/"/> + <property name="user.timezone" value="Europe/Oslo"/> + <property name="os.name" value="Windows 10"/> + <property name="java.vm.specification.version" value="16"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="user.country" value="NO"/> + <property name="sun.boot.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin"/> + <property name="sun.java.command" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar C:\Users\Administrator\AppData\Local\Temp\surefire5581609503519300717 2022-02-21T13-41-52_107-jvmRun1 surefire13063935482054520860tmp surefire_06238391663110193232tmp"/> + <property name="jdk.debug" value="release"/> + <property name="surefire.test.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="sun.cpu.endian" value="little"/> + <property name="user.home" value="C:\Users\Administrator"/> + <property name="user.language" value="no"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="java.version.date" value="2021-07-20"/> + <property name="java.home" value="C:\Program Files\Java\jdk-16.0.2"/> + <property name="file.separator" value="\"/> + <property name="basedir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="java.vm.compressedOopsMode" value="32-bit"/> + <property name="line.separator" value=" "/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="surefire.real.class.path" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar"/> + <property name="user.script" value=""/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="java.runtime.version" value="16.0.2+7-67"/> + <property name="user.name" value="Administrator"/> + <property name="path.separator" value=";"/> + <property name="os.version" value="10.0"/> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + <property name="file.encoding" value="Cp1252"/> + <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/> + <property name="localRepository" value="C:\Users\Administrator\.m2\repository"/> + <property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/> + <property name="java.io.tmpdir" value="C:\Users\ADMINI~1\AppData\Local\Temp\"/> + <property name="idea.version" value="2021.2.2"/> + <property name="java.version" value="16.0.2"/> + <property name="user.dir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="os.arch" value="amd64"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="sun.os.patch.level" value=""/> + <property name="java.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\Documents\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Local\GitHubDesktop\bin;."/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.vendor" value="Oracle Corporation"/> + <property name="java.vm.version" value="16.0.2+7-67"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="java.class.version" value="60.0"/> + </properties> + <testcase name="attack" classname="SpecificUnits.CommanderUnitTest" time="0"/> + <testcase name="getAttackBonus" classname="SpecificUnits.CommanderUnitTest" time="0"/> + <testcase name="testToString" classname="SpecificUnits.CommanderUnitTest" time="0"/> + <testcase name="getName" classname="SpecificUnits.CommanderUnitTest" time="0"/> + <testcase name="setHealth" classname="SpecificUnits.CommanderUnitTest" time="0"/> + <testcase name="getAttack" classname="SpecificUnits.CommanderUnitTest" time="0.001"/> + <testcase name="getHealth" classname="SpecificUnits.CommanderUnitTest" time="0"/> + <testcase name="getResistBonus" classname="SpecificUnits.CommanderUnitTest" time="0"/> + <testcase name="getArmor" classname="SpecificUnits.CommanderUnitTest" time="0.001"/> + <testcase name="getMelee" classname="SpecificUnits.CommanderUnitTest" time="0"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/TEST-SpecificUnits.InfantryUnitTest.xml b/target/surefire-reports/TEST-SpecificUnits.InfantryUnitTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..ecb6328f17c10a1aded967653279509fdbf902a0 --- /dev/null +++ b/target/surefire-reports/TEST-SpecificUnits.InfantryUnitTest.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="SpecificUnits.InfantryUnitTest" time="0.004" tests="10" errors="0" skipped="0" failures="0"> + <properties> + <property name="java.specification.version" value="16"/> + <property name="sun.cpu.isalist" value="amd64"/> + <property name="sun.jnu.encoding" value="Cp1252"/> + <property name="java.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="java.vm.vendor" value="Oracle Corporation"/> + <property name="sun.arch.data.model" value="64"/> + <property name="user.variant" value=""/> + <property name="java.vendor.url" value="https://java.oracle.com/"/> + <property name="user.timezone" value="Europe/Oslo"/> + <property name="os.name" value="Windows 10"/> + <property name="java.vm.specification.version" value="16"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="user.country" value="NO"/> + <property name="sun.boot.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin"/> + <property name="sun.java.command" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar C:\Users\Administrator\AppData\Local\Temp\surefire5581609503519300717 2022-02-21T13-41-52_107-jvmRun1 surefire13063935482054520860tmp surefire_06238391663110193232tmp"/> + <property name="jdk.debug" value="release"/> + <property name="surefire.test.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="sun.cpu.endian" value="little"/> + <property name="user.home" value="C:\Users\Administrator"/> + <property name="user.language" value="no"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="java.version.date" value="2021-07-20"/> + <property name="java.home" value="C:\Program Files\Java\jdk-16.0.2"/> + <property name="file.separator" value="\"/> + <property name="basedir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="java.vm.compressedOopsMode" value="32-bit"/> + <property name="line.separator" value=" "/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="surefire.real.class.path" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar"/> + <property name="user.script" value=""/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="java.runtime.version" value="16.0.2+7-67"/> + <property name="user.name" value="Administrator"/> + <property name="path.separator" value=";"/> + <property name="os.version" value="10.0"/> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + <property name="file.encoding" value="Cp1252"/> + <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/> + <property name="localRepository" value="C:\Users\Administrator\.m2\repository"/> + <property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/> + <property name="java.io.tmpdir" value="C:\Users\ADMINI~1\AppData\Local\Temp\"/> + <property name="idea.version" value="2021.2.2"/> + <property name="java.version" value="16.0.2"/> + <property name="user.dir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="os.arch" value="amd64"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="sun.os.patch.level" value=""/> + <property name="java.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\Documents\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Local\GitHubDesktop\bin;."/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.vendor" value="Oracle Corporation"/> + <property name="java.vm.version" value="16.0.2+7-67"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="java.class.version" value="60.0"/> + </properties> + <testcase name="attack" classname="SpecificUnits.InfantryUnitTest" time="0"/> + <testcase name="getAttackBonus" classname="SpecificUnits.InfantryUnitTest" time="0"/> + <testcase name="testToString" classname="SpecificUnits.InfantryUnitTest" time="0"/> + <testcase name="getName" classname="SpecificUnits.InfantryUnitTest" time="0.001"/> + <testcase name="setHealth" classname="SpecificUnits.InfantryUnitTest" time="0"/> + <testcase name="getAttack" classname="SpecificUnits.InfantryUnitTest" time="0.001"/> + <testcase name="getHealth" classname="SpecificUnits.InfantryUnitTest" time="0"/> + <testcase name="getResistBonus" classname="SpecificUnits.InfantryUnitTest" time="0"/> + <testcase name="getArmor" classname="SpecificUnits.InfantryUnitTest" time="0"/> + <testcase name="getMelee" classname="SpecificUnits.InfantryUnitTest" time="0"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/TEST-SpecificUnits.RangedUnitTest.xml b/target/surefire-reports/TEST-SpecificUnits.RangedUnitTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..6d636239390a00ff88eb7049f857f259796dc7f6 --- /dev/null +++ b/target/surefire-reports/TEST-SpecificUnits.RangedUnitTest.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="SpecificUnits.RangedUnitTest" time="0.005" tests="10" errors="0" skipped="0" failures="0"> + <properties> + <property name="java.specification.version" value="16"/> + <property name="sun.cpu.isalist" value="amd64"/> + <property name="sun.jnu.encoding" value="Cp1252"/> + <property name="java.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="java.vm.vendor" value="Oracle Corporation"/> + <property name="sun.arch.data.model" value="64"/> + <property name="user.variant" value=""/> + <property name="java.vendor.url" value="https://java.oracle.com/"/> + <property name="user.timezone" value="Europe/Oslo"/> + <property name="os.name" value="Windows 10"/> + <property name="java.vm.specification.version" value="16"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="user.country" value="NO"/> + <property name="sun.boot.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin"/> + <property name="sun.java.command" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar C:\Users\Administrator\AppData\Local\Temp\surefire5581609503519300717 2022-02-21T13-41-52_107-jvmRun1 surefire13063935482054520860tmp surefire_06238391663110193232tmp"/> + <property name="jdk.debug" value="release"/> + <property name="surefire.test.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="sun.cpu.endian" value="little"/> + <property name="user.home" value="C:\Users\Administrator"/> + <property name="user.language" value="no"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="java.version.date" value="2021-07-20"/> + <property name="java.home" value="C:\Program Files\Java\jdk-16.0.2"/> + <property name="file.separator" value="\"/> + <property name="basedir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="java.vm.compressedOopsMode" value="32-bit"/> + <property name="line.separator" value=" "/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="surefire.real.class.path" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar"/> + <property name="user.script" value=""/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="java.runtime.version" value="16.0.2+7-67"/> + <property name="user.name" value="Administrator"/> + <property name="path.separator" value=";"/> + <property name="os.version" value="10.0"/> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + <property name="file.encoding" value="Cp1252"/> + <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/> + <property name="localRepository" value="C:\Users\Administrator\.m2\repository"/> + <property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/> + <property name="java.io.tmpdir" value="C:\Users\ADMINI~1\AppData\Local\Temp\"/> + <property name="idea.version" value="2021.2.2"/> + <property name="java.version" value="16.0.2"/> + <property name="user.dir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="os.arch" value="amd64"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="sun.os.patch.level" value=""/> + <property name="java.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\Documents\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Local\GitHubDesktop\bin;."/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.vendor" value="Oracle Corporation"/> + <property name="java.vm.version" value="16.0.2+7-67"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="java.class.version" value="60.0"/> + </properties> + <testcase name="attack" classname="SpecificUnits.RangedUnitTest" time="0"/> + <testcase name="getAttackBonus" classname="SpecificUnits.RangedUnitTest" time="0"/> + <testcase name="testToString" classname="SpecificUnits.RangedUnitTest" time="0"/> + <testcase name="getName" classname="SpecificUnits.RangedUnitTest" time="0.001"/> + <testcase name="setHealth" classname="SpecificUnits.RangedUnitTest" time="0"/> + <testcase name="getAttack" classname="SpecificUnits.RangedUnitTest" time="0.001"/> + <testcase name="getHealth" classname="SpecificUnits.RangedUnitTest" time="0"/> + <testcase name="getResistBonus" classname="SpecificUnits.RangedUnitTest" time="0.001"/> + <testcase name="getArmor" classname="SpecificUnits.RangedUnitTest" time="0"/> + <testcase name="getMelee" classname="SpecificUnits.RangedUnitTest" time="0"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/TEST-UnitTest.xml b/target/surefire-reports/TEST-UnitTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..f838b9ae9c6884cbc07eaaa9074757034451f730 --- /dev/null +++ b/target/surefire-reports/TEST-UnitTest.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="UnitTest" time="0.001" tests="2" errors="0" skipped="0" failures="0"> + <properties> + <property name="java.specification.version" value="16"/> + <property name="sun.cpu.isalist" value="amd64"/> + <property name="sun.jnu.encoding" value="Cp1252"/> + <property name="java.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="java.vm.vendor" value="Oracle Corporation"/> + <property name="sun.arch.data.model" value="64"/> + <property name="user.variant" value=""/> + <property name="java.vendor.url" value="https://java.oracle.com/"/> + <property name="user.timezone" value="Europe/Oslo"/> + <property name="os.name" value="Windows 10"/> + <property name="java.vm.specification.version" value="16"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="user.country" value="NO"/> + <property name="sun.boot.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin"/> + <property name="sun.java.command" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar C:\Users\Administrator\AppData\Local\Temp\surefire5581609503519300717 2022-02-21T13-41-52_107-jvmRun1 surefire13063935482054520860tmp surefire_06238391663110193232tmp"/> + <property name="jdk.debug" value="release"/> + <property name="surefire.test.class.path" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\test-classes;C:\Users\Administrator\Arbkrav\Porsjekt\WarGame\target\classes;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;"/> + <property name="sun.cpu.endian" value="little"/> + <property name="user.home" value="C:\Users\Administrator"/> + <property name="user.language" value="no"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="java.version.date" value="2021-07-20"/> + <property name="java.home" value="C:\Program Files\Java\jdk-16.0.2"/> + <property name="file.separator" value="\"/> + <property name="basedir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="java.vm.compressedOopsMode" value="32-bit"/> + <property name="line.separator" value=" "/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="surefire.real.class.path" value="C:\Users\ADMINI~1\AppData\Local\Temp\surefire5581609503519300717\surefirebooter7708134046907286707.jar"/> + <property name="user.script" value=""/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="java.runtime.version" value="16.0.2+7-67"/> + <property name="user.name" value="Administrator"/> + <property name="path.separator" value=";"/> + <property name="os.version" value="10.0"/> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + <property name="file.encoding" value="Cp1252"/> + <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/> + <property name="localRepository" value="C:\Users\Administrator\.m2\repository"/> + <property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/> + <property name="java.io.tmpdir" value="C:\Users\ADMINI~1\AppData\Local\Temp\"/> + <property name="idea.version" value="2021.2.2"/> + <property name="java.version" value="16.0.2"/> + <property name="user.dir" value="C:\Users\Administrator\Arbkrav\Porsjekt\WarGame"/> + <property name="os.arch" value="amd64"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="sun.os.patch.level" value=""/> + <property name="java.library.path" value="C:\Program Files\Java\jdk-16.0.2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\Documents\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Local\GitHubDesktop\bin;."/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.vendor" value="Oracle Corporation"/> + <property name="java.vm.version" value="16.0.2+7-67"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="java.class.version" value="60.0"/> + </properties> + <testcase name="Test_Exception_Thrown_IfName_Is_Blank" classname="UnitTest" time="0.001"/> + <testcase name="Test_Exception_Thrown_If_Health_Is_Less_Than_Zero" classname="UnitTest" time="0"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/UnitTest.txt b/target/surefire-reports/UnitTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..3627e87877ac5753610e23926f26a3ad4e77fca5 --- /dev/null +++ b/target/surefire-reports/UnitTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: UnitTest +------------------------------------------------------------------------------- +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in UnitTest diff --git a/target/test-classes/BattleSimulation/ArmyTest.class b/target/test-classes/BattleSimulation/ArmyTest.class new file mode 100644 index 0000000000000000000000000000000000000000..3b5001d81621bb805d97e7ebd065ddb9ee391145 Binary files /dev/null and b/target/test-classes/BattleSimulation/ArmyTest.class differ diff --git a/target/test-classes/BattleSimulation/BattleTest.class b/target/test-classes/BattleSimulation/BattleTest.class new file mode 100644 index 0000000000000000000000000000000000000000..185a0edd7f503da1c11d7d98a4a326f0428824de Binary files /dev/null and b/target/test-classes/BattleSimulation/BattleTest.class differ diff --git a/target/test-classes/SpecificUnits/CavalryUnitTest$1.class b/target/test-classes/SpecificUnits/CavalryUnitTest$1.class new file mode 100644 index 0000000000000000000000000000000000000000..62e38725fca01548461b24a2d6db974093fc7be0 Binary files /dev/null and b/target/test-classes/SpecificUnits/CavalryUnitTest$1.class differ diff --git a/target/test-classes/SpecificUnits/CavalryUnitTest$2.class b/target/test-classes/SpecificUnits/CavalryUnitTest$2.class new file mode 100644 index 0000000000000000000000000000000000000000..1105e2f1de426e88d561765cb19f0dca6a21e977 Binary files /dev/null and b/target/test-classes/SpecificUnits/CavalryUnitTest$2.class differ diff --git a/target/test-classes/SpecificUnits/CavalryUnitTest.class b/target/test-classes/SpecificUnits/CavalryUnitTest.class new file mode 100644 index 0000000000000000000000000000000000000000..12d188a51f6ed00f21cac2be1245cc3ccbd701d4 Binary files /dev/null and b/target/test-classes/SpecificUnits/CavalryUnitTest.class differ diff --git a/target/test-classes/SpecificUnits/CommanderUnitTest$1.class b/target/test-classes/SpecificUnits/CommanderUnitTest$1.class new file mode 100644 index 0000000000000000000000000000000000000000..d3a9c3aded7bfbb11f489ada59b82bfec200d2fa Binary files /dev/null and b/target/test-classes/SpecificUnits/CommanderUnitTest$1.class differ diff --git a/target/test-classes/SpecificUnits/CommanderUnitTest$2.class b/target/test-classes/SpecificUnits/CommanderUnitTest$2.class new file mode 100644 index 0000000000000000000000000000000000000000..3713e65a984c1326c1d1032fe6d0c9c3d3382be4 Binary files /dev/null and b/target/test-classes/SpecificUnits/CommanderUnitTest$2.class differ diff --git a/target/test-classes/SpecificUnits/CommanderUnitTest.class b/target/test-classes/SpecificUnits/CommanderUnitTest.class new file mode 100644 index 0000000000000000000000000000000000000000..6b6fc2c5eea45ad3dd05e5673c4cc1160029b67b Binary files /dev/null and b/target/test-classes/SpecificUnits/CommanderUnitTest.class differ diff --git a/target/test-classes/SpecificUnits/InfantryUnitTest$1.class b/target/test-classes/SpecificUnits/InfantryUnitTest$1.class new file mode 100644 index 0000000000000000000000000000000000000000..9c2dc884b5daca3355977d6151098d0cf7212da8 Binary files /dev/null and b/target/test-classes/SpecificUnits/InfantryUnitTest$1.class differ diff --git a/target/test-classes/SpecificUnits/InfantryUnitTest$2.class b/target/test-classes/SpecificUnits/InfantryUnitTest$2.class new file mode 100644 index 0000000000000000000000000000000000000000..71dc9f908d62ad5e87feba8dff972bb2b157dd14 Binary files /dev/null and b/target/test-classes/SpecificUnits/InfantryUnitTest$2.class differ diff --git a/target/test-classes/SpecificUnits/InfantryUnitTest.class b/target/test-classes/SpecificUnits/InfantryUnitTest.class new file mode 100644 index 0000000000000000000000000000000000000000..d27944c43fe3eca587115fe6e40381f6609c0948 Binary files /dev/null and b/target/test-classes/SpecificUnits/InfantryUnitTest.class differ diff --git a/target/test-classes/SpecificUnits/RangedUnitTest$1.class b/target/test-classes/SpecificUnits/RangedUnitTest$1.class new file mode 100644 index 0000000000000000000000000000000000000000..219085139277d1e3bd6f5a762183c58bfc2848f0 Binary files /dev/null and b/target/test-classes/SpecificUnits/RangedUnitTest$1.class differ diff --git a/target/test-classes/SpecificUnits/RangedUnitTest$2.class b/target/test-classes/SpecificUnits/RangedUnitTest$2.class new file mode 100644 index 0000000000000000000000000000000000000000..f874b0cb6857aed61f83468c6d37958ca9bd9e8b Binary files /dev/null and b/target/test-classes/SpecificUnits/RangedUnitTest$2.class differ diff --git a/target/test-classes/SpecificUnits/RangedUnitTest.class b/target/test-classes/SpecificUnits/RangedUnitTest.class new file mode 100644 index 0000000000000000000000000000000000000000..345de74831353712373a85c628058df8b068df10 Binary files /dev/null and b/target/test-classes/SpecificUnits/RangedUnitTest.class differ diff --git a/target/test-classes/UnitTest.class b/target/test-classes/UnitTest.class new file mode 100644 index 0000000000000000000000000000000000000000..9a81092aa151b59639b2e565ca877611038bd66e Binary files /dev/null and b/target/test-classes/UnitTest.class differ diff --git a/target/wargame-0.1-SNAPSHOT.jar b/target/wargame-0.1-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..889282a7512aa9dd35ea6255efd7c8ece76f2090 Binary files /dev/null and b/target/wargame-0.1-SNAPSHOT.jar differ