Java Testing (java-testing)

Controlling Time with Java Clock

Use java.time.Clock to control time in your unit tests. This article will mainly focus on usage of fixed clock and offset clock.

How CompletableFuture is tested in OpenJDK?

How CompletableFuture is tested in OpenJDK 14? What can we learn from it?

Mockito: 3 Ways to Init Mock in JUnit 5

Initialize Mockito mock objects in JUnit 5 using MockitoExtension, MockitoAnnotations#initMocks, or Mockito#mock.

Testing Elasticsearch With Docker And Java High Level REST Client

Testing Elasticsearch with docker and Java High Level REST Client

Logback: Test Logging Event

Capture SLF4J + Logback logging events and test them in unit tests using ListAppender.

Mockito: ArgumentCaptor

Three ways to create ArgumentCaptor in unit tests (Mockito JUnit Runner, annotations, or factory method) and its different usage.

Mockito: 4 Ways to Verify Interactions

Verify interaction with mock objects with verify(), verifyZeroInteractions() verifyNoMoreInteractions(), and inOrder().

Mockito: 3 Ways to Init Mock in JUnit 4

Initialize Mockito mock objects in JUnit 4 using MockitoJUnitRunner, MockitoAnnotations#initMocks, or Mockito#mock.

6 Tips for Fixing Bugs with Legacy Frameworks

In my daily work, I have to deal with legacy frameworks. Here are 6 tips that I summarized for bug-fixing, including documentation, searching, testing, patching library and more.

TDD: After 3 Months' Practice

I started TDD in all my personal projects 3 months ago. Here're some thoughts about it, including architecture, IDE, methodology, execution speed up, legacy code, and limits.

Testing JAX-RS Resources

This article explains how to set up and tear down a Grizzly Server for testing JAX-RS resources, how to create a HTTP request and assert the response using JUnit 4. And finally, the limits of testing API in reality.

Introduction to Selenium WebDriver

A quick introduction to Selenium WebDriver, a practical tool for running functional tests and browser automation. The sample is written with Firefox 58 and GeckoDriver 0.20.