Writing Comparators - The Java 8 Way

Java 8 introduced a few default methods and static factory methods on the Comparator interface using which developers can write Comparators in a declarative way. The Comparator interface combines the principles from Builder Pattern, Factory Method Pattern, Decorator Pattern and Functional Programming to come up with a very expressive API.... [Read More]

RxJava - Part 3 - Multithreading

RxJava makes it easy to write asynchronous and concurrent applications. To be able to do that you will have to write programs that get executed on multiple threads. In this article I will show how RxJava helps in writing multithreaded programs using Scheduler and Observable‚Äôs subscribeOn() and observeOn() methods. [Read More]

RxJava - Part 2 - Creating an Observable

An Observable is the heart of RxJava. It is the source of data or events in Reactive Programming. RxJava provides many methods in its library to create an Observable. Choosing which one to use can be difficult. My goal from this article is to help you in making this choice... [Read More]

Testing REST APIs with REST-assured

REST APIs are HTTP-based web services that adhere to REST architectural constraints. If you look up now-a-days systems that talk to each other over web, it is highly probable that you will find REST APIs being used. In this article I will focus on REST-assured, a tool from Jayway for... [Read More]
Tags: java testing

Scoped Objects in Dagger 2

When you use Dependency Injection, you may want to create objects that have different life-cycles. As an example, you may want some objects to live as long as the application lives, and some to live only for a short duration, like only for the duration of a request. Such objects... [Read More]
Tags: java

Writing Test Data Builders Made Easy With Kotlin

In this article I will be focusing on few features of Kotlin that help in writing concise and readable code. To explain the features, I will be using the concept of Test Data Builders, as described in the book Growing Object-Oriented Software, Guided by Tests. I hope that by the... [Read More]
Tags: kotlin testing

Understanding Thread Interruption in Java

You may come across use cases where you would need to perform some long running tasks on separate threads. You may have to request these tasks to finish doing their work, may be even before the tasks are completely done, so that the threads they would be running on can... [Read More]
Tags: java