
Posted In: Hamcrest, Junit, Testing
How to create own custom Hamcrest matcher using TypeSafeMatcher
Usecase – Create own custom Hamcrest matcher using TypeSafeMatcher Hamcrest 1.3 Classes used from Hamcrest org.hamcrest.Description org.hamcrest.TypeSafeMatcher Custom substring matcher Custom sublist matcher Custom matcher test
Read More
Posted In: Hamcrest, Junit, Testing
How to unit test String output – JUnit + Hamcrest
Usecase – You need to unit test String output. Hamcrest library may be useful to achieve that. Hamcrest 1.3 Classes used from Hamcrest org.hamcrest.CoreMatchers.allOf org.hamcrest.CoreMatchers.anyOf Using ErrorCollector so that execution continues even if assert statement fails.
Read More
Posted In: Hamcrest, Junit, Testing
How to unit test list is empty – JUnit + Hamcrest
Usecase – You need to unit test if list is empty. Hamcrest library may be useful to achieve that Hamcrest 1.3 Classes used from Hamcrest org.hamcrest.collection.IsCollectionWithSize org.hamcrest.number.OrderingComparison Using ErrorCollector so that execution continues even if assert statement fails.
Read More
Posted In: Hamcrest, Junit, Testing
How to unit test XML – JUnit + Hamcrest
Usecase – You need to unit test XML output and write multiple scenarios to test the data. Hamcrest library may be useful to achieve that Hamcrest XPATH Matchers Hamcrest 1.3 Classes used from Hamcrest import org.hamcrest.xml.HasXPath Using ErrorCollector so that execution continues even if assert statement fails.
Read More
Posted In: Hamcrest, Junit, Testing
Hamcrest – containsInAnyOrder syntax
Sample using Hamcrest shows following way to use the code So I expected even following should be possible. This code does not work as is. Hamcrest 1.3 Classes used from Hamcrest import org.hamcrest.collection.IsIterableContainingInAnyOrder; Using ErrorCollector so that execution continues even if assert statement fails. Output
Read More
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 Map – JUnit + Hamcrest
Usecase – You need to unit test Map 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.IsIn; org.hamcrest.collection.IsMapContaining; Using ErrorCollector so that execution continues even if assert statement fails. Output
Read MoreTags: Map equality using 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
- 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)