Debian Codegraph @

FaCT++.Java/src/test/java/conformancetests/JUnitRunnerFromFile.java

raw symbols SCIP
1 package conformancetests;
2
3 /* This file is part of the JFact DL reasoner
4 Copyright 2011-2013 by Ignazio Palmisano, Dmitry Tsarkov, University of Manchester
5 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
6 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
7 You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA*/
8 import java.io.BufferedReader;
9 import java.io.File;
10 import java.io.FileInputStream;
11 import java.io.InputStreamReader;
12 import java.io.Reader;
13
14 @SuppressWarnings("javadoc")
15 public class JUnitRunnerFromFile extends JUnitRunner {
16
17 public static String readFile(File f) {
18 StringBuilder b = new StringBuilder();
19 try (FileInputStream in = new FileInputStream(f);
20 Reader reader = new InputStreamReader(in);
21 BufferedReader r = new BufferedReader(reader);) {
22 String l = r.readLine();
23 while (l != null) {
24 b.append(l);
25 b.append('\n');
26 l = r.readLine();
27 }
28 } catch (Exception e) {
29 e.printStackTrace();
30 throw new RuntimeException(e);
31 }
32 return b.toString();
33 }
34
35 public JUnitRunnerFromFile(File premise, File consequence, String testId,
36 TestClasses t, String description) {
37 super(readFile(premise), readFile(consequence), testId, t, description);
38 }
39 }