Mahesh Perumandala

Greenhorn
+ Follow
since Jul 29, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mahesh Perumandala

No nothing i don't have anything yet, i need to write a test class for that java class, i mean we can take the basepath and check with Directory like this

" Assert.assertEquals(basePath, baseFile.isDirectory()); " , so can you write a test class.
10 years ago
I have written the java code for xls to xlsx converter, but i'm not good at writing the Junit test cases, so can you help me out how to write a test class for below code , thanks you.

import java.io.File;

public class XlsToXlsxConverter
{
public static void main(String[] args)
{
String basePath = "C:\\Users\\peramm1\\Documents\\IDX\\";

File baseFile = new File(basePath);

if (baseFile.isDirectory())
{
File[] filesList = baseFile.listFiles();

try
{
for (File eachFile: filesList)
{
String fileName = eachFile.getName();
if (fileName.endsWith(".xls"))
{
String[][] excelData = AdvancedApachePOI.readXls(eachFile.getAbsolutePath());
String writeFileName = eachFile.getAbsolutePath().replaceAll(".xls", ".xlsx");
AdvancedApachePOI.writeXlsx(excelData, writeFileName);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
10 years ago