Tournament list #11
|
@ -132,4 +132,9 @@ public class FileIO {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteTournament(File tournamentFile) throws IOException {
|
||||||
|
throw new UnsupportedOperationException("Method deleteTournament not implemented yet.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,19 +82,19 @@ class FileIOTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void loadTournamentNotExisting(){
|
void loadTournamentNotExisting(){
|
||||||
io = new FileIO(mainDir);
|
File file = new File("Not-existing-File");
|
||||||
assertThrows(FileNotFoundException.class, () -> io.loadTournament(new File("Not-existing-File")));
|
assertFalse(file.exists());
|
||||||
|
assertThrows(FileNotFoundException.class, () -> io.loadTournament(file));
|
||||||
|
assertFalse(file.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void loadTournamentEmpty(){
|
void loadTournamentEmpty(){
|
||||||
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
|
||||||
void loadTournamentFileNull(){
|
void loadTournamentFileNull(){
|
||||||
io = new FileIO(mainDir);
|
|
||||||
assertThrows(IllegalArgumentException.class, () -> io.loadTournament(null));
|
assertThrows(IllegalArgumentException.class, () -> io.loadTournament(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,4 +129,35 @@ class FileIOTest {
|
||||||
assertThrows(IllegalArgumentException.class, () -> io.saveTournament(null));
|
assertThrows(IllegalArgumentException.class, () -> io.saveTournament(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
class Delete{
|
||||||
|
@BeforeEach
|
||||||
|
void setup(){
|
||||||
|
mainDir = RESOURCES_DIR + "FileIODelete";
|
||||||
|
io = new FileIO(mainDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void deleteTournament() throws IOException {
|
||||||
|
File file = new File(mainDir + "/saves/test1.txt");
|
||||||
|
file.createNewFile();
|
||||||
|
assertTrue(file.exists());
|
||||||
|
io.deleteTournament(file);
|
||||||
|
assertFalse(file.exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void deleteTournamentNotExisting() throws IOException {
|
||||||
|
File file = new File("Not-existing-File");
|
||||||
|
assertFalse(file.exists());
|
||||||
|
assertThrows(FileNotFoundException.class, () -> io.deleteTournament(file));
|
||||||
|
assertFalse(file.exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void deleteTournamentNull(){
|
||||||
|
assertThrows(IllegalArgumentException.class, () -> io.deleteTournament(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue