Skip to content

Commit

Permalink
update getTest() to read from a file, if one is provided (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
BedoMagdi authored Oct 4, 2024
1 parent ff99268 commit e44303c
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
*/

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -686,6 +689,24 @@ public void setReportsDirectory( File reportsDirectory )
@Override
public String getTest()
{
File f = new File( test );
if ( f.exists() && !f.isDirectory ( ) )
{
try
{
List<String> l = Files.readAllLines( f.toPath(), Charset.defaultCharset( ) );
StringBuilder sb = new StringBuilder( );
for ( String s : l )
{
sb.append( s + "," );
}
String s = sb.toString( );
return s.substring( 0 , s.length( ) - 1 );
}
catch ( IOException e )
{
}
}
return test;
}

Expand Down

0 comments on commit e44303c

Please sign in to comment.