When you are unit testing, it is sometimes necessary to supplement an object with dummy data. Unfortunately, to fill a large object manually, it crawls a lot of time and work. Fortunately, there is a tool that saves us the time and work!
How to skip maven unit test in Eclipse
When you want to build, install, clean… maven. You have to run all the unit tests. The problem is when you have plenty of tests or database connections to test, the time that the build need is way too long. It is possible to build without running the tests. You can configure that in Eclipse:
How to test a private constructor
You can test a private constructor by using Reflection. Insert the following code in your unit test class:
How to find the similarity rate of two objects
How can you find the similarity rate of two objects expressed by a percentage? Read it below.
For example, I have two objects with the same object type. In this example we have an object ‘contact’.
How to find objects by attributes in Hibernate
What if you have an object without ID. How do you know if that object already exists in the database?
How to format a website URL in Java
Most people want uniformity in their database. That is not always easy when you let the user enter data. Website URLs can come in all sizes. But how should you create an exactly uniform URL?
How to unit test a DAO class in Java
When you test a DAO class. It is possible you insert or update test data in your database. Of course, we don’t want that. There is a possibility to rollback the transaction when your test is completed.
We use EasyMock to do so.
How to unit test getters and setters in Java
It is possible to test getters and setters (properties) from your model class. Through a test class, it is done in no time.
How to unit test equals and hashcode
The equals and hashcode methodes are simple to test with JQNO.
How to unit test a web service
To test your web service, you can use Smock. Smock compares your request with the response by XML files. You just need a response.xml file with your response and a request.xml file with your request.