I have 10 Java test case files saved in a directory. The folder structure looks like this,
Test Folder
test1.java
test2.java
.
.
etc.
In each of these files, there are different Java Unit Test Cases.
For example, test1.java looks like this,
@Test
public void testAdd1Plus1()
{
int x = 1 ; int y = 1;
assertEquals(2, myClass.add(x,y));
}
I would like to count the number of lines in each file in this "Test Folder" directory and save the line count for each file in a separate directory called "testlines"
For example, "testlines" directory structure would look like this,
testlines
test1.java
test2.java
.
.
etc.
The content of the test1.java of the "testlines" directory should be 5 since test1.java from the Test Folder directory has five lines of code.
How can I write a Java program to achieve this criteria?