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
Object Pool addObject method example
In this post under Apache Pool, I will explain with example the purpose of “addObject” method in Apache Pool. In Apache Pool we can create three types of object Pool1) GenericObjectPool2) GenericKeyedObjectPool3) SoftReferenceObjectPool All these classes support “addObject” method. Now lets understand the purpose of this method. If you refer to all my previous post,…… Continue reading Object Pool addObject method example
Configuring Generic Object Pool
In this post under Apache Pool, I will show how to create GenericObjectPool instance with custom configuration In all post under Apache Pool, I showed how to create GenericObjectPool using default configuration. When we use the below code snippet, we are creating an object pool with default configuration. GenericObjectPool<Thread> genericObjectPool = new GenericObjectPool<Thread>(threadPooledObjectFactory); To change…… Continue reading Configuring Generic Object Pool
Creating a soft reference object pool
In this post under Apache Pool, we will explain with example how to create soft reference object pool. For our example we will create the below thread factory class that extends Apache Pool framework’s “BasePooledObjectFactory” class. package package6;import org.apache.commons.pool2.BasePooledObjectFactory;import org.apache.commons.pool2.PooledObject;import org.apache.commons.pool2.impl.DefaultPooledObject;public class ThreadPooledObjectFactory extends BasePooledObjectFactory<Thread> { private int count = 0; @Override public Thread create()…… Continue reading Creating a soft reference object pool