Category: Testing
Netflix Hystrix Asynchronous Execution Example
In this tutorial we show you how to execute a asynchronous Hystrix command. We use the HystrixCommand which is used to wrap code that will execute potentially risky functionality. Typically meaning a service call...
Netflix Hystrix Synchronous Execution Example
In this tutorial we show you how to execute a synchronous Hystrix command. We use the HystrixCommand which is used to wrap code that will execute potentially risky functionality. Typically meaning a service call...
Spring Security + Spring LDAP Authentication Configuration Example
In this tutorial we demonstrate how to Configure Spring Security + Spring LDAP authentication application. We show how to configure spring security and spring LDAP using Java And XML Configuration. LDAP is often used...
Spring Mail Integration Testing with JUnit and GreenMail Example
In this example we show how to use Spring Mail and write Integration Tests using JUnit and GreenMail. We start by writing a simple email service that sends out emails. We want to verify...
Spring Boot + Spring LDAP Integration Testing Example
In this example we demonstrate how to use spring boot and spring ldap for writing ldap integration tests. We set up an embedded LDAP server and populate it with a custom schema.ldif file. Project...
Spring Boot – Managing Profiles with @Profile Annotation Example
Spring Profiles provides a way to segregate parts of your application configuration and make it only available in certain environments. This is particularly useful when configuring different environments like development and/or production. In the...
Unit Test JPA with JUnit H2 In Memory Database
This tutorial shows how to Unit Test JPA with JUnit and a H2 In Memory Database. Some people disagree and don’t call these unit tests, but integration tests. Imho there is some truth in...
JUnit ErrorCollector Verify All Asserts Before Failing
When JUnit encounters an assert failure it’ll immediately fail the test. Sometimes this is not desirable and you want to inspect all the assert statements before failing the test. The JUnit ErrorCollector rule was...
JUnit Exception Testing
Testing code that throws exceptions is as important than testing only the happy path. It may be even more important. Luckily JUnit provides us with a basic toolkit to verify if an exception is...