Lesson Monday

Now that we've started writing simple apps, and are becoming more and more familiar with both IntelliJ and Java, we can finally begin testing these apps! In this lesson we'll address how to write and run JUnit tests, and interpret their results.

Once we have the basics down, the next lesson will build a Ping Pong application to completion, demonstrating what the entire Red, Green, Refactor workflow looks like in conjunction with JUnit.

Getting Started

Begin by forking this starter project to your GitHub account. Then, clone it down to your machine. We'll complete this same workflow throughout the Java unit, whenever we provide starter code, so it's a good opportunity to practice this workflow, as well.

Ping Pong Starter Repo

Opening a Cloned Repo

Once you have forked the repo to your github account, copy the repo link as you would for any other project.

opening-cloned-repo-1

Open up a terminal window, and execute $ git clone http://github.com/yourUserName/yourRepo.git as you have done in intro to programming.

opening-cloned-repo-2

Now, open IntelliJ, and select File > Open and then browse to the project directory. Do not browse into the src/main/java directory, simply select the top most level in the directory (the project folder itself). Click Open.

opening-cloned-repo-3

On the next screen, select Create directories for empty content roots automatically and the Use gradle wrapper task configuration radio button. Click OK.

opening-cloned-repo-4

Your project will load, and you'll see file directories appear slowly. Wait a few seconds, and then you should see your familiar file structure and you can begin working on your tests for the next lesson.

opening-cloned-repo-5