Software Development

Mock methods that return void

Previously, I posted Void methods and Mockito in Java that verifies if any of the methods of a object passed as a argument were invoked. This time we want to alter the behavior of a method that returns void.

Software Development

Java 8 – Redeclare default methods

In Java, you can extend from another interface using the extends keyword. But Java 8 has default methods. What happens if we extend another interface that has the same default methods as our interface?

It gets re-declared in the “child” interface.

Software Development

Java – Copy array by range

This post will show you how to copy a subset elements of an array by range. For example, copy elements from index 3 to 4 (exclusive). The range values work in the same way as the String’s substring method.