-Method readFile done and tested
-Method getSpaceType done and once tested
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package ch.zhaw.pm2.racetrack;
|
||||
|
||||
import ch.zhaw.pm2.racetrack.given.ConfigSpecification;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class TrackTest {
|
||||
Track trackObj;
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
File file = new File("C:\\Studium\\Semester2\\PM2\\Projekt1\\racetrack\\tracks\\challenge.txt");
|
||||
try {
|
||||
trackObj = new Track(file);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error in Test compareTrack" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void canReadFile() {
|
||||
File file = new File("C:\\Studium\\Semester2\\PM2\\Projekt1\\racetrack\\tracks\\challenge.txt");
|
||||
Assertions.assertThrows(FileNotFoundException.class,() -> new Track(file));
|
||||
}
|
||||
|
||||
/**
|
||||
* Dirty test...
|
||||
*/
|
||||
@Test
|
||||
void compareTrack() {
|
||||
try {
|
||||
List<String> track = trackObj.getTrack();
|
||||
for (String s: track
|
||||
) {
|
||||
System.out.println(s);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error in Test compareTrack" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSpaceTyp() {
|
||||
Assertions.assertEquals(ConfigSpecification.SpaceType.FINISH_RIGHT,trackObj.getSpaceType(new PositionVector(22,24)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user