In this post under Apache Pool, I will explain Apache Pool’s object retrieval strategy with example. Whenever we request an object from an object pool, by default it follows LIFO (Last In First Out) strategy, to retrieve an idle object. For example if in a pool, object are added in the below order and all…… Continue reading Object Pools object retrieval strategy
Setting headers example
In this post under Spring WebClient, I will explain with example how to set headers before making a HTTP call. Below is the complete code for your reference Main class 1 package defaultPackage; 2 3 import org.springframework.web.reactive.function.client.ClientResponse; 4 import org.springframework.web.reactive.function.client.WebClient; 5 6 import reactor.core.publisher.Mono; 7 8 public class Example5 { 9 public static void main(String[]…… Continue reading Setting headers example
Setting accept header example
In this post under Spring WebClient, I will explain with example how to set “ACCEPT” header before sending an HTTP GET request. Below is the complete main code for your reference. Main class 1 package defaultPackage; 2 3 import org.springframework.http.MediaType; 4 import org.springframework.web.reactive.function.client.ClientResponse; 5 import org.springframework.web.reactive.function.client.WebClient; 6 7 import reactor.core.publisher.Mono; 8 9 public class Example6…… Continue reading Setting accept header example
Simple Delete example
In this post under Spring WebClient, I will explain with example how to perform simple DELETE HTTP request. Below is the complete code for your reference. Main class 1 package defaultPackage; 2 3 import org.springframework.web.reactive.function.client.ClientResponse; 4 import org.springframework.web.reactive.function.client.WebClient; 5 6 import reactor.core.publisher.Mono; 7 8 public class Example4 { 9 public static void main(String[] args) throws…… Continue reading Simple Delete example
Simple Put example
In this post under WebClient, I will show with example how to make a simple PUT HTTP request using WebClient framework. Below is the complete main method for your reference Main class 1 package defaultPackage; 2 3 import org.springframework.web.reactive.function.client.WebClient; 4 import reactor.core.publisher.Mono; 5 6 public class Example3 { 7 public static void main(String[] args) throws…… Continue reading Simple Put example
Simple Post example
In this post under WebClient, I will show with example how to make a simple POST HTTP request using WebClient framework. Below is the complete main method for your reference Main class 1 package defaultPackage; 2 3 import org.springframework.web.reactive.function.client.WebClient; 4 import reactor.core.publisher.Mono; 5 6 public class Example2 { 7 public static void main(String[] args) throws…… Continue reading Simple Post example
Simple Get example
In this post under WebClient, I will show with example how to make a simple GET HTTP request using WebClient framework. Below is the complete main method for your reference Main class 1 package defaultPackage; 2 3 import org.springframework.web.reactive.function.client.WebClient; 4 5 import reactor.core.publisher.Mono; 6 7 public class Example1 { 8 public static void main(String[] args)…… Continue reading Simple Get example
assumingThat example
In this post under JUnit, I will explain the purpose of “assumingThat” assertion method. In my previous postAssumptions in JUnit 5 I showed you how to use “assumeTrue” and “assumeFalse” assumption statements. Lets add that code here again for recap Below is the class to be tested. MockUserRepository package package14;public class MockUserRepository { private boolean…… Continue reading assumingThat example
@TestInstance example
In this post under JUnit, I will explain with example the purpose of “TestInstance” annotation. By default when we execute a test class, for each test method, a separate instance of test class is created. Lets see an example. For our example I will create the below “Calculator” class that has to be tested. Calculator…… Continue reading @TestInstance example
AssertAll Example
In this post under JUnit 5, I will show with example the purpose of “assertAll” method. Pre JUnit 5, If a testcase had multiple assert statements, the testing of that testcase would stop immediately at the first assert statement that fails. So for example if we have below test method public void testMethod() { assert1…… Continue reading AssertAll Example