|
package com.cp.adrabi.jln.todo.tests.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
/**
* Class Test utils
*
* @author ADRABI Abderrahim (z3vil)
*
*/
public class TestUtil
{
private static Logger LOG = Logger.getLogger(TestUtil.class);
/**
* Make resources list
*
* @param filename
* @param rootPath
* @return
*/
public static List<Resource> makeResources(String filename, String rootPath)
{
List<Resource> resources = new ArrayList<Resource>();
BufferedReader br = new BufferedReader( new InputStreamReader(TestUtil.class.getResourceAsStream(filename)));
String line = null;
try
{
while( (line = br.readLine()) != null )
{
resources.add( new FileSystemResource(rootPath + line) );
}
}
catch (IOException e)
{
LOG.fatal("Can't create resources", e);
}
return resources;
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.