File Upload and File Download REST APIs Testing using Rest Assured in Java

Introduction In this tutorial I will show you how to test REST APIs used for file upload and file download. The file upload or download application might have been created using any server side technology. I am going to use here Rest Assured library with Junit 5 framework in Java programming language. I will use multipart for file upload test….

Find Closest Number from Array to the Given Number in Java

In this tutorial you will find closest number from array to the given number. Given an array of sorted integers, find the closest value to the given number. The array may contain duplicate values and negative numbers. Examples Array : 2,5,6,7,8,8,9Target number : 5Output : 5

How to check or make a number palindrome in Java

Here we will create an example on how to check a given number is palindrome or not. We will also make the given number palindrome if it is not palindrome. In our other tutorial we have seen how to check a string is palindrome or not. A string or number is palindrome if it is equal to its reversed counterpart….

Supplier, Consumer and BiConsumer in Java 8

Introduction I will discuss here about the new feature added to Java 8 – a functional interface, Supplier, Consumer and BiConsumer. In simple words, a supplier is a method that returns a value. A supplier is any method which takes no arguments and returns a value. Its job is to supply an instance of an expected class. Whereas, a consumer…

Automation Testing using Cucumber and Selenium Web Driver

Introduction This tutorial will show you how to perform automation testing using Cucumber and Selenium web driver. Cucumber is a BDD framework used to perform behavior testing whereas Selenium is used to perform automation testing for web applications across different browsers and platforms. In this example we will search a keyword in Google website and verify whether it returns a…

Cucumber Tags Example

Introduction In this tutorial you will see how to work on Cucumber Tags. Tags in Cucumber are great ways to organize your features and scenarios. It is pretty much simple when you have one, two, or maybe five scenarios in a feature file. However, in real life project, for each feature, you may have 20, 30, or may be more…

How to find longest substring without repeating characters using Java

Introduction In this example we will see how to find longest substring from a given string without repeating characters using Java programming language. A given string when broken into substring will have different lengths and we will find the string which has longest length among them. A string may consist of contiguous characters or several words separated by spaces.

Add images to Excel file using Apache POI in Java

Introduction In this tutorial we will see an example on how to add images to excel file using Apache POI in Java programming language. Using Apache POI library it becomes easy to insert or add images into excel file. Images are part of the drawing support. To add an image just call createPicture() on the drawing patriarch. In this example we will…

How to shuffle an ArrayList using Java

Introduction In this example we will see how to shuffle an ArrayList using Java programming language. We will use shuffle() method from Collections class to shuffle the ArrayList. We will also create our own method to shuffle the ArrayList. Shuffle means rearrange the elements of the ArrayList by sliding them over each other quickly. So we will basically swap or…

@WebMvcTest Annotation Example in Spring MVC Applications

Introduction We will see the use of @WebMvcTest annotation in Spring MVC applications. The Spring MVC application may be Spring Boot application as well. The @WebMvcTest annotation can be used not only to test Spring Controllers but also Spring REST Controllers. We will build the applications using both maven and gradle tools. @WebMvcTest annotation is used for unit testing of…