R
Rhino
I have some classes that generate flat files and I'm trying to think of some
simple way to test to see that they are working correctly.
The classes in question read a ResourceBundle for data, then format that
data and write them out to a flat file with a PrintWriter. The only obvious
method of testing that comes to mind is to create a file that contains what
_should_ be in the generated file, then see if the file which is actually
generated is identical to the expected result. That would fall within the
basic design of JUnit. But I'm not sure how to compare two files within
JUnit even if that is the best way of testing the file generators.
Is there a way to compare two files within JUnit? If not, is there some
other way to test my file generating classes?
simple way to test to see that they are working correctly.
The classes in question read a ResourceBundle for data, then format that
data and write them out to a flat file with a PrintWriter. The only obvious
method of testing that comes to mind is to create a file that contains what
_should_ be in the generated file, then see if the file which is actually
generated is identical to the expected result. That would fall within the
basic design of JUnit. But I'm not sure how to compare two files within
JUnit even if that is the best way of testing the file generators.
Is there a way to compare two files within JUnit? If not, is there some
other way to test my file generating classes?