88import static org .junit .jupiter .api .Assertions .*;
99
1010import java .io .*;
11+ import java .nio .file .Files ;
1112import java .util .Arrays ;
1213import java .util .stream .Stream ;
1314
1415import org .junit .jupiter .params .ParameterizedTest ;
1516import org .junit .jupiter .params .provider .*;
1617import org .slf4j .*;
1718
18- import com .google .common .base .Charsets ;
19- import com .google .common .io .*;
20-
2119/**
2220 *
2321 * @author shevek
@@ -28,23 +26,25 @@ public class RegressionTest {
2826
2927 public static Stream <Arguments > data () throws Exception {
3028 File dir = new File ("build/resources/test/regression" );
31- return Arrays .stream (dir .listFiles (new PatternFilenameFilter (".*\\ .in" ))).map (inFile -> {
32- String name = Files .getNameWithoutExtension (inFile .getName ());
33- File outFile = new File (dir , name + ".out" );
34- return Arguments .of (name , inFile , outFile );
35- });
29+ return Arrays .stream (dir .listFiles ())
30+ .filter (inFile -> inFile .getName ().endsWith (".in" ))
31+ .map (inFile -> {
32+ String name = inFile .getName ().replace (".in" , "" );
33+ File outFile = new File (dir , name + ".out" );
34+ return Arguments .of (name , inFile , outFile );
35+ });
3636 }
3737
3838 @ ParameterizedTest
3939 @ MethodSource ("data" )
4040 public void testRegression (String name , File inFile , File outFile ) throws Exception {
41- String inText = Files .toString (inFile , Charsets . UTF_8 );
41+ String inText = Files .readString (inFile . toPath () );
4242 LOG .info ("Read " + name + ":\n " + inText );
4343 Preprocessor pp = new Preprocessor (new StringReader (inText ));
4444 String generatedText = pp .printToString ();
4545 LOG .info ("Generated " + name + ":\n " + generatedText );
4646 if (outFile .exists ()) {
47- String outText = Files .toString (outFile , Charsets . UTF_8 );
47+ String outText = Files .readString (outFile . toPath () );
4848 LOG .info ("Expected " + name + ":\n " + outText );
4949 assertEquals (outText , inText );
5050 }
0 commit comments