Fxml #8
|
@ -15,6 +15,6 @@ public class App {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println(new App().getGreeting());
|
System.out.println(new App().getGreeting());
|
||||||
|
|
||||||
FileIO io = new FileIO(System.getProperty("user.dir") + File.separator + "tournierverwaltung_angrynerds");
|
FileIO io = new FileIO(System.getProperty("user.dir") + "/tournierverwaltung_angrynerds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
class FileIOTest {
|
class FileIOTest {
|
||||||
|
|
||||||
String RESOURCES_DIR = ".\\src\\test\\resources\\ch\\zhaw\\projekt2\\turnierverwaltung\\";
|
String RESOURCES_DIR = "./src/test/resources/ch/zhaw/projekt2/turnierverwaltung/";
|
||||||
String mainDir;
|
String mainDir;
|
||||||
String saveDir;
|
String saveDir;
|
||||||
FileIO io;
|
FileIO io;
|
||||||
|
@ -25,7 +25,7 @@ class FileIOTest {
|
||||||
@Test
|
@Test
|
||||||
void FileIONewDir() throws IOException {
|
void FileIONewDir() throws IOException {
|
||||||
mainDir = RESOURCES_DIR + "FileIONew";
|
mainDir = RESOURCES_DIR + "FileIONew";
|
||||||
saveDir = mainDir + "\\" + "saves";
|
saveDir = mainDir + "/saves";
|
||||||
File mainDirFile = new File(mainDir);
|
File mainDirFile = new File(mainDir);
|
||||||
File saveDirFile = new File(mainDir);
|
File saveDirFile = new File(mainDir);
|
||||||
try{
|
try{
|
||||||
|
@ -75,7 +75,7 @@ class FileIOTest {
|
||||||
void loadTournament() throws IOException, ClassNotFoundException {
|
void loadTournament() throws IOException, ClassNotFoundException {
|
||||||
mainDir = RESOURCES_DIR + "FileIORead";
|
mainDir = RESOURCES_DIR + "FileIORead";
|
||||||
io = new FileIO(mainDir);
|
io = new FileIO(mainDir);
|
||||||
Tournament tournament = io.loadTournament(new File(mainDir + "\\saves\\test1.txt"));
|
Tournament tournament = io.loadTournament(new File(mainDir + "/saves/test1.txt"));
|
||||||
assertEquals("test1", tournament.getName());
|
assertEquals("test1", tournament.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class FileIOTest {
|
||||||
@Test
|
@Test
|
||||||
void loadTournamentEmpty(){
|
void loadTournamentEmpty(){
|
||||||
io = new FileIO(mainDir);
|
io = new FileIO(mainDir);
|
||||||
assertThrows(IOException.class, () -> io.loadTournament(new File(mainDir + "\\saves\\empty.txt")));
|
assertThrows(IOException.class, () -> io.loadTournament(new File(mainDir + "/saves/empty.txt")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -110,7 +110,7 @@ class FileIOTest {
|
||||||
void saveTournament() {
|
void saveTournament() {
|
||||||
Tournament tournament = new Tournament("test1");
|
Tournament tournament = new Tournament("test1");
|
||||||
io.saveTournament(tournament);
|
io.saveTournament(tournament);
|
||||||
File file = new File(mainDir + "\\saves\\test1.txt");
|
File file = new File(mainDir + "/saves/test1.txt");
|
||||||
if(file.exists()){
|
if(file.exists()){
|
||||||
file.delete();
|
file.delete();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue