I am using an external library in a java project but I am not sure how can I integration test it with my code.
For example: Let us say I am using a string encryption library to encrypt passwords.
Please enlighten.
Thanks
I am using an external library in a java project but I am not sure how can I integration test it with my code.
For example: Let us say I am using a string encryption library to encrypt passwords.
Please enlighten.
Thanks
You are probably thinking of integration testing, not unit testing. Generally I don't unit test code that isn't my own. What I would do for integration testing is basically write tests similar to my unit tests for my code, but not mock out the external library -- i.e., use it directly. You may need to do some set up to create a test environment, including any data you want to use in the test, in which to carry this out. The integration tests may be less extensive than your unit tests since you really only need to test the paths that exercise the external functionality, not necessarily all paths through your code.
I was looking through Stack overflow and I might have to use a bridge pattern for this. Not entirely sure but then again I have only spent a little time on this probably needs more investigation.