Generic Way Of Writing Data In Excel Using Apache POI

Writing To Excel Sheet The example is about generic way of writing data in excel using apache poi library in Java programming language. With this example I will show you how to create an excel file and write any kind of objects using Java’s reflection API to excel file with the help of Apache POI. In this example I am…

Immediate attribute example in JSF

Introduction This tutorial will show you what is the purpose of using immeditae attribute in JSF. Although the request processing lifecycle processes the different phases in a consistent manner, the execution order of the phases can be altered for special cases. For example, you may want to add a Cancel button to a form. When clicked, it will skip all…

JSF 2, Maven and Tomcat 7 Configuration

This tutorial will show you how we can configure JSF 2.x, maven and Tomcat 7. For this tutorial we will create maven based web project in Eclipse. If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Create Batch File Using Java

Batch File Creation In this post, I will show you how to create batch file (having an extension as .bat) and execute it using Java. Along with this batch file I am also going to write some content in this batch file so that while executing this batch file I will give some output. Batch file is generally created under…

Using Jetty Server with Junit test

In this post I will show you how to use Jetty server with Junit test case and how to deploy web application using Java program in Junit test. If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Remove Duplicate Objects from a List using Java

In this post, I will show you how to remove duplicate objects from a List using Java’s Comparator interface implementation based on multiple fields in a POJO. You can also check the duplicate objects in a list by overriding hashCode() and equals() methods in the POJO class. In other words, you are going to get the unique objects from the…

Find Duplicate Objects in a List using Java

In this post, I will show you how to find duplicate objects in a List using Java’s Comparator interface implementation based on multiple fields in a POJO. Prerequisites The following configurations are required in order to run the application Eclipse JDK 1.8 Have maven installed and configured Junit, Mockito, PowerMockito dependency in pom.xml Now we will see the below steps…

JUnit Mockito doNothing Example

Introduction In this post, I will be showing Junit mockito doNothing example in one of the most widely used and popular JUnit Testing Mocking framework – Mockito. I am going to use PowerMock API to test Java classes. I am going to show you when to use doNothing() method.

JUnit Mockito doReturn Example

In this post, I will be showing one of the most widely used and popular JUnit Testing Mocking framework – Mockito. Mockito is one of the widely used testing API for Java. I am going to show you how to work with doReturn() and when to use it for testing your Java class using Junit.

Exception Handling Best Practices in Java

I am going to tell you what are the best practices for handling exceptions in Java applications. An exception is an event that occurs during the execution of a program that disrupts the normal flow of the program and the program terminates abnormally. Types of Exception – the exception can be either a checked exception or an unchecked exception.