diff options
Diffstat (limited to 'test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java')
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java b/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java deleted file mode 100644 index 14050ce..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java +++ /dev/null | |||
| @@ -1,35 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import com.google.gson.Gson; | ||
| 4 | import com.google.gson.reflect.TypeToken; | ||
| 5 | import org.testng.Assert; | ||
| 6 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | ||
| 7 | |||
| 8 | import java.io.BufferedReader; | ||
| 9 | import java.io.IOException; | ||
| 10 | import java.lang.reflect.Type; | ||
| 11 | import java.nio.file.Files; | ||
| 12 | import java.nio.file.Path; | ||
| 13 | import java.util.Set; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * It provides auxiliary methods for checking answers. | ||
| 17 | * */ | ||
| 18 | public class CheckAnswers { | ||
| 19 | |||
| 20 | private CheckAnswers() { | ||
| 21 | } | ||
| 22 | |||
| 23 | public static void assertSameAnswers(Path computedAnswersFile, Path givenAnswersFile) throws IOException { | ||
| 24 | BufferedReader computedReader = Files.newBufferedReader(computedAnswersFile); | ||
| 25 | BufferedReader givenReader = Files.newBufferedReader(givenAnswersFile); | ||
| 26 | |||
| 27 | Gson gson = QueryRecord.GsonCreator.getInstance(); | ||
| 28 | |||
| 29 | Type cqType = new TypeToken<Set<QueryRecord>>() {}.getType(); | ||
| 30 | Set<QueryRecord> computedAnswers = gson.fromJson(computedReader, cqType); | ||
| 31 | Set<QueryRecord> givenAnswers = gson.fromJson(givenReader, cqType); | ||
| 32 | |||
| 33 | Assert.assertEquals(computedAnswers, givenAnswers); | ||
| 34 | } | ||
| 35 | } | ||
