prasadtalasila / BITS-Darshini

A Modular, Concurrent and Customizable Protocol Analyzer
GNU General Public License v3.0
5 stars 12 forks source link

adds unit tests for in.ac.bits.protocolanalyzer.utils #142

Closed adityaketkar closed 6 years ago

prasadtalasila commented 6 years ago

@adityaketkar good work. Please post the code coverage statistics message / screenshot given by Eclipse for the unit tests of util package. Ideally the code coverage would be 90%+ for all the classes of util package.

adityaketkar commented 6 years ago

image

@prasadtalasila Its well above 90 for all the classes but Security.java How to test the two highlighted exceptions?

prasadtalasila commented 6 years ago

@adityaketkar please check the String(byte[] bytes, Charset charset) constructor of String class. You can change the Charset to something that's not compatible with utf-8 and then induce the exception. You can try different character sets mentioned on Charset page.

You can let go of the NoSuchAlgorithmException. Changing that would require dependency injection which is not desirable for this class.

adityaketkar commented 6 years ago

@prasadtalasila Of all the supported character-sets given here, I could not find any which is not compatible. I tried to google it but could not find any solution.

We basically need a valid charset that is not compatible with UTF-8, am I correct?

prasadtalasila commented 6 years ago

Yes. Please see this stackoverflow thread. We just need to consider special characters / non-ASCII characters to reveal the difference between the character sets.

adityaketkar commented 6 years ago

https://github.com/prasadtalasila/BITS-Darshini/blob/b68e10745dce20cbb3107df43750325bd2ca5752/src/main/java/in/ac/bits/protocolanalyzer/mvc/controller/HomeController.java#L94

@prasadtalasila the Security.createHash() is called in HomeController.java to create hash of the login-id and password of the user.

prasadtalasila commented 6 years ago

@adityaketkar You can retain the existing unit tests of Security.createHash() method. Our usage does not demand additional tests for the code. You can focus on adding hamcrest status messages and fixing codeclimate code quality issues.

prasadtalasila commented 6 years ago

@adityaketkar good progress. There are still a few more code climate issues.

adityaketkar commented 6 years ago

@prasadtalasila codeclimate says that ip address should be configurable. How do I work around the issue?

prasadtalasila commented 6 years ago

@adityaketkar good work.