public class FileSystemResource extends Object implements DataResource
public static Object[][] dataProviderGetAllDocuments() throws IOException { FileSystemResource resource = new FileSystemResource(fileName, USER.class); Object[][] data = YamlDataProvider.getAllData(resource); return data; }If test requires passing multiple arguments, multiple YamlResources can be defined to create such a data provider.
public static Object[][] dataProviderGetMultipleArguments() throws IOException { List<FileSystemResource> yamlResources = new ArrayList<FileSystemResource>(); yamlResources.add(new FileSystemResource(fileName1, USER.class)); yamlResources.add(new FileSystemResource(fileName2, USER.class)); Object[][] data = YamlDataProvider.getAllDataMultipleArgs(yamlResources); return data; }Test method signature example:
public void testExample(USER user1, USER user2)
Constructor and Description |
---|
FileSystemResource(String fileName)
Use this constructor when a data source file can be found as a resource and does NOT contain a user-defined object.
|
FileSystemResource(String fileName,
Class<?> cls)
Use this constructor when a data source file can be found as a resource and contains a user-defined object.
|
Modifier and Type | Method and Description |
---|---|
Class<?> |
getCls()
Fetch the user defined POJO class
|
InputStream |
getInputStream()
Load the input stream of the data file
|
String |
getType()
Fetch the data file extension
|
void |
setCls(Class<?> cls)
Set the user defined POJO class to map data
|
String |
toString() |
public FileSystemResource(String fileName, Class<?> cls)
fileName
- cls
- public FileSystemResource(String fileName)
fileName
- public Class<?> getCls()
DataResource
getCls
in interface DataResource
public final void setCls(Class<?> cls)
DataResource
setCls
in interface DataResource
public InputStream getInputStream()
DataResource
getInputStream
in interface DataResource
public String getType()
DataResource
getType
in interface DataResource
Copyright © 2016 PayPal Open Source. All rights reserved.