O'Reilly logo

Test-Driven Java Development - Second Edition by Viktor Farcic, Alex Garcia

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up the environment

In order to explore some of the goodies of Java Functional Programming in a test-driven fashion, we are going to set up a Java project with JUnit and AssertJ frameworks. The last one includes quite a few convenient methods for Optional

Let's start a new Gradle project. This is how build.gradle looks:

apply plugin: 'java'sourceCompatibility = 1.8targetCompatibility = 1.8repositories {  mavenCentral()}dependencies {  testCompile group: 'junit', name: 'junit', version: '4.12'  testCompile group: 'org.assertj', name: 'assertj-core', version: '3.9.0'}

In the following sections, we are going to explore some of the utilities and classes included in Java 8 that enhance the experience of programming. Most of them are not ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required