Test read file.
()
| 75 | * Test read file. |
| 76 | */ |
| 77 | @Test |
| 78 | void testReadFile() { |
| 79 | // Try file not found |
| 80 | assertThat("no file", FileUtil.readFile(NO_FILE), is(empty())); |
| 81 | // Try this file |
| 82 | List<String> thisFile = FileUtil.readFile(THISCLASS); |
| 83 | // Comment ONE line |
| 84 | int lineOne = 0; |
| 85 | // Comment TWO line |
| 86 | int lineTwo = 0; |
| 87 | for (int i = 0; i < thisFile.size(); i++) { |
| 88 | String line = thisFile.get(i); |
| 89 | if (lineOne == 0 && line.contains("Comment ONE line")) { |
| 90 | lineOne = i; |
| 91 | } else if (lineTwo == 0 && line.contains("Comment TWO line")) { |
| 92 | lineTwo = i; |
| 93 | break; |
| 94 | } |
| 95 | } |
| 96 | assertThat("Comment line difference", lineTwo - lineOne, is(2)); |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Test get*FromFile |
nothing calls this directly
no test coverage detected