Blog Archives
1 2 3

01: JUnit with Mockito step by step

Step 1: Create a simple maven project say “code-quality”



01: jvisualvm tutorial to sample Java heap memory

Java does not have a sizeof operator like C++ does. Java uses automatic memory management known as the Garbage Collection, hence it is not that important to evaluate size of various …



02: jvisualvm to detect memory leak – a quick tutorial style Java demo

This is a companion post to 8 Java Memory Management Interview Q&A demonstrating a memory leak scenario step by step with jvisualvm, which is a free profiling tool that gets shipped …



02: Unit testing with JUnit, Mockito & Spring

Step 1: Create a simple Maven project from a command-line. Just press enter for all the prompts.



03: Mockito to fully mock the DAO layer

This extends Part 1: Unit testing with JUnit, Mockito & Spring by mocking the DAO layer with the Mockito framework. Step 1: Service and DAO layer interfaces and implementations Service Layer …



04: Mockito partially mocking with @Spy

This extends Part 2: Mockito to fully mock the DAO layer by modifying the service layer to demonstrate partial mocking with “Mockito.spy”. In the “SimpleServiceImpl” we are interested in only testing …



05: Mockito & PowerMock partially mocking private methods with @Spy

This extends Part 3: Mockito partially mocking with @Spy by making the method “processUser(int id)” as a private method. Mockito framework cannot mock “private” methods, hence the “PowerMock” framework is added …



06: Mockito & PowerMock for mocking static methods

This extends Part 4: Mockito & PowerMock for partially mocking private methods to mock “static” methods.

How to use both Spring JUnit and PowerMock runners?

By using the “@PowerMockRunnerDelegate” …



30+ Java Code Review Checklist Items

This Java code review checklist is not only useful during code reviews, but also to answer an important Java job interview question,

Q. How would you go about evaluating code quality …



5 Java unit testing interview Questions and Answers

Q1 Why use mock objects in unit testing? A1 Unit testing is widely accepted as a “best practice” for software development. When you write an object, you must also provide an …



8+ JMeter performance testing interview Q&As

Performance testing is an important process of any software development. You can bring this up yourself to many open-ended questions like — Tell me about yourself? What are some of your …



Ensuring code quality in Java Q&As

Q1. How do you ensure code quality in your application? A1. Code quality means writing readable, maintainable and robust code, that conforms as much as possible to the style-guideline that is …



Integration Unit testing Spring Transaction Management

This is an integration testing that tests Spring transaction through service, and DAO layers all the way up to the embedded database like HSQLDB or H2. After commit or rollback, the …



1 2 3

300+ Java Interview FAQs

800+ Java Interview Q&As

Top