(PrintWriter stdout)
| 203 | // ---------------------------------------------------------------------- |
| 204 | |
| 205 | static void checkTestFiles(PrintWriter stdout) throws IOException { |
| 206 | for (int i=1; i<=79; i++) { |
| 207 | String filePath = "./../TestFiles/Valid_" + String.format("%03d", i); |
| 208 | stdout.println("Checking valid test file: " + filePath); |
| 209 | String[][] loadedRows = loadRsv(filePath + ".rsv"); |
| 210 | String jsonStr = rsvToJson(loadedRows); |
| 211 | |
| 212 | String loadedJsonStr = new String(Files.readAllBytes(Paths.get(filePath + ".json")), StandardCharsets.UTF_8); |
| 213 | if (!jsonStr.equals(loadedJsonStr)) { |
| 214 | throw new RuntimeException("JSON mismatch"); |
| 215 | } |
| 216 | |
| 217 | if (!isValidRsv(Files.readAllBytes(Paths.get(filePath + ".rsv")))) { |
| 218 | throw new RuntimeException("Validation mismatch"); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | for (int i=1; i<=29; i++) { |
| 223 | String filePath = "./../TestFiles/Invalid_" + String.format("%03d", i); |
| 224 | stdout.println("Checking invalid test file: " + filePath); |
| 225 | boolean wasError = false; |
| 226 | try { |
| 227 | loadRsv(filePath + ".rsv"); |
| 228 | } catch(Exception e) { |
| 229 | wasError = true; |
| 230 | } |
| 231 | if (!wasError) { |
| 232 | throw new RuntimeException("RSV document is valid"); |
| 233 | } |
| 234 | if (isValidRsv(Files.readAllBytes(Paths.get(filePath + ".rsv")))) { |
| 235 | throw new RuntimeException("Validation mismatch"); |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | // ---------------------------------------------------------------------- |
| 241 |
no test coverage detected