fixed typos in several classes
This commit is contained in:
parent
efe1e1f304
commit
d0da883795
|
@ -42,4 +42,4 @@ We choose a simple branching model where all starting features got a branch and
|
|||
|
||||
## Class Diagramm
|
||||
This Class Diagramm is additional to the Class Diagramm given in the Anleitung.pdf<br><br>
|
||||
![Classdiagramm of this program](./Klassendiagramm.svg)
|
||||
![Classdiagram of this program](./Klassendiagramm.svg)
|
||||
|
|
|
@ -97,7 +97,7 @@ public class Car implements CarSpecification {
|
|||
/**
|
||||
* Set this Car position directly, regardless of current position and velocity.
|
||||
* This should only be used by the game controller in rare cases to set the crash or winning position.
|
||||
* The next position is normaly automatically calculated and set in the {@link #move()} method.
|
||||
* The next position is normally automatically calculated and set in the {@link #move()} method.
|
||||
*
|
||||
* @param position The new position to set the car directly to.
|
||||
* @throws IllegalArgumentException if invalid PositionVector is given.
|
||||
|
|
|
@ -6,7 +6,6 @@ import ch.zhaw.pm2.racetrack.strategy.*;
|
|||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static ch.zhaw.pm2.racetrack.PositionVector.Direction;
|
||||
|
@ -36,7 +35,6 @@ public class Game implements GameSpecification {
|
|||
public boolean initPhase() {
|
||||
if (config.getTrackDirectory().listFiles().length > 0) {
|
||||
List<String> tracks = new ArrayList<>();
|
||||
tracks.addAll(Arrays.asList(config.getTrackDirectory().list()));
|
||||
|
||||
File selectedTrack = config.getTrackDirectory().listFiles()[userInterface.selectOption("Select Track file", tracks)];
|
||||
try {
|
||||
|
|
|
@ -55,7 +55,7 @@ import java.util.Scanner;
|
|||
* <li>the file contains more than {@link Config#MAX_CARS} cars</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>The Track can return a String representing the current state of the race (including car positons)</p>
|
||||
* <p>The Track can return a String representing the current state of the race (including car positions)</p>
|
||||
*/
|
||||
public class Track implements TrackSpecification {
|
||||
|
||||
|
@ -347,7 +347,7 @@ public class Track implements TrackSpecification {
|
|||
* If there is a crashed car at the position, {@link #CRASH_INDICATOR} is returned.
|
||||
*
|
||||
* @param y position Y-value
|
||||
* @param x position X-vlaue
|
||||
* @param x position X-value
|
||||
* @param currentSpace char to return if no car is at position (x,y)
|
||||
* @return character representing position (x,y) on the track
|
||||
*/
|
||||
|
|
|
@ -21,9 +21,9 @@ class CarTest {
|
|||
Car car;
|
||||
|
||||
// Default coordinates for tests
|
||||
int DEFAULT_X = 10;
|
||||
int DEFAULT_Y = 10;
|
||||
char DEFAULT_ID = 'f';
|
||||
final int DEFAULT_X = 10;
|
||||
final int DEFAULT_Y = 10;
|
||||
final char DEFAULT_ID = 'f';
|
||||
|
||||
/**
|
||||
* Create a new Car Object and set Position to a defined Default Position
|
||||
|
@ -50,7 +50,7 @@ class CarTest {
|
|||
|
||||
/**
|
||||
* - checks if the position of the car can be set and saved correctly with valid positions.
|
||||
* - checks if an exception is throwed and position keeps unchanged if invalid coordinates are entered.
|
||||
* - checks if an exception is thrown and position keeps unchanged if invalid coordinates are entered.
|
||||
*/
|
||||
@Test
|
||||
void setPosition() {
|
||||
|
@ -118,7 +118,7 @@ class CarTest {
|
|||
int expectedNextPosX = DEFAULT_X;
|
||||
int expectedNextPosY = DEFAULT_Y;
|
||||
|
||||
//variables to save the acutal expected result of method getVelocity
|
||||
//variables to save the actual expected result of method getVelocity
|
||||
int expectedVelocityX = 0;
|
||||
int expectedVelocityY = 0;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class GameTest {
|
|||
private final int CAR_INDEX_TWO = 1;
|
||||
|
||||
/**
|
||||
* This nested Class tests if the game gets initiatet correctly.
|
||||
* This nested Class tests if the game gets initiated correctly.
|
||||
*/
|
||||
@Nested
|
||||
@DisplayName("Test correct Setup")
|
||||
|
|
|
@ -60,7 +60,7 @@ public class TrackTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Converts Trackfile correctly to List<String>")
|
||||
@DisplayName("Converts track file correctly to List<String>")
|
||||
void checkTrack() {
|
||||
Track trackObj;
|
||||
try {
|
||||
|
@ -153,8 +153,8 @@ public class TrackTest {
|
|||
@Test
|
||||
@DisplayName("Throw error if File is invalid")
|
||||
void invalidTrackFile() {
|
||||
File testfile = new File(".\\src\\test\\InvalidTracks\\sameCar.txt");
|
||||
Assertions.assertThrows(InvalidTrackFormatException.class, () -> new Track(testfile));
|
||||
File testFile = new File(".\\src\\test\\InvalidTracks\\sameCar.txt");
|
||||
Assertions.assertThrows(InvalidTrackFormatException.class, () -> new Track(testFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue