I am having this logic to check a java file content and verify that it has a comment, which says who is the author(not necessarily the creator) of that filea special project requirement.
I wrote unit test with Junitlogic checker and it works fine.
And I want all the files .javato adhere to this standard and make build fail if at least one of them does not meet this.
So far I have a testing method Junitto do the following:
- Read the entire contents of the file
.javain the application - For each content, check to see if it contains a comment that has a standard format
- A test case could not be completed if at least one of them has no comments with this format (so that in the end the assembly will fail)
Is this the right approach? This will serve the purpose, but is it useful to use a test Junitto perform some kind of performance check .
If not, which approach should I use for analysis (using my logic - I have an Analyzer.java file with logic) all the files during the build and have a success construct if all the files comply with the standard.
EDIT:
Checking for code comments is just one check. There are several checks that must be performed. (for example: variable names must end with a given suffix, templates for using some internal libraries, etc.). All scripts are processed in this logic (Analyzer.java). You just need to check the entire contents of the java file and use this logic to verify them.
I have a java library and when invoked a method that accept a file name , check(fileName) , it will analyze the file and return true if it pass some invisible logic. false, . , - , jUnit, .java .
(, ), . , .