
Posted In: Hamcrest, Junit, Testing
How to unit test a date – JUnit + Hamcrest
Usecase – You need to unit test Date output and write multiple scenarios to test the data. Hamcrest library may be useful to achieve that Hamcrest Date Matchers Hamcrest 1.3 Classes used from Hamcrest import org.hamcrest.number.OrderingComparison; Using ErrorCollector so that execution continues even if assert statement fails. Output
Read MoreTags: Date equality using Hamcrest, Hamcrest

Posted In: Hamcrest, Junit, Testing
How to unit test a Integer array – JUnit + Hamcrest
Usecase – You need to unit test Integer array output and write multiple scenarios to test the data. Hamcrest library may be useful to achieve that Hamcrest 1.3 Classes used from Hamcrest org.hamcrest.collection.IsArray; org.hamcrest.collection.IsArrayContaining; org.junit.rules.ErrorCollector; Using ErrorCollector so that execution continues even if assert statement fails. Output
Read MoreTags: Hamcrest

Posted In: Hamcrest, Junit, Testing
How to unit test a string array – JUnit + Hamcrest
Usecase – You need to unit test string array output and write multiple scenarios to test the data. Hamcrest library may be useful to achieve that Hamcrest 1.3 Classes used from Hamcrest org.hamcrest.collection.IsArray; org.hamcrest.collection.IsArrayContaining; org.junit.rules.ErrorCollector; Using ErrorCollector so that execution continues even if assert statement fails. Output
Read MoreTags: Hamcrest

Posted In: JSON
Check two JSON Objects for equality – Hamcrest-JSON
This example uses hamcrest-json library Examples using Hamcrest-JSON 1. Success test with a org.json.JSONObject 2. Error test with a org.json.JSONObject 3. Success test with a JSON String 4. Error test with a JSON String
Read MoreTags: Compare two JSON objects in Java, Hamcrest, JSON, JSONAssert
- Apache (13)
- Build Tools (2)
- Gradle (2)
- Caching (1)
- cpanel (1)
- cURL (1)
- Database (7)
- Hibernate (5)
- Java Core (38)
- Java Script (15)
- Bootstrap (1)
- File Upload (7)
- jQuery (3)
- React (3)
- JEE (13)
- JSON (41)
- GSON (13)
- Jackson 1X (1)
- Jackson 2X (12)
- jsoniter (1)
- Logging (2)
- Apache Commons Logging (1)
- Apache Log4J (1)
- Logback (1)
- SLF4J (1)
- MongoDB (1)
- OS (1)
- Linux (1)
- Security (5)
- Server (4)
- Tomcat (4)
- Service (2)
- Micro (2)
- Spring (46)
- Pattern (2)
- Spring Boot (20)
- Spring Data (4)
- Spring MVC (8)
- Spring REST (13)
- Spring Security (7)
- Testing (11)
- XML (5)
- JDOM XML Parser (1)