assertArraysEquals example

In this post under Junit 5, I will explain with example the purpose of “assertArraysEquals” method. We can use the “assertArraysEquals” method to assert whether two arrays are equal or not. Below is the complete main code for your reference. Main Class package package15;import static org.junit.jupiter.api.Assertions.assertAll;import static org.junit.jupiter.api.Assertions.assertArrayEquals;import org.junit.jupiter.api.Test;public class Example15 { @Test public void…… Continue reading assertArraysEquals example

Creating text file of user specified size with random data

In this post under Java, I will show with example how to create a text file of user specified size with random data. Below is the complete code for you example Main class 1 package io;2 3 import java.io.BufferedWriter;4 import java.io.File;5 import java.io.FileWriter;6 import java.io.IOException;7 import java.util.Random;8 9 public class IOExample1 {10 private Random random;11…… Continue reading Creating text file of user specified size with random data

MaxWait duration property

In this post under Apache Pool, I will explain with example the purpose of “MaxWait” duration property. This property is used in conjunction with “BlockWhenExhausted” property explained in previous post. This property works only when “BlockWhenExhausted” is set to “true”. When “BlockWhenExhausted” is set to true and the caller tries to get idle objects more…… Continue reading MaxWait duration property

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