From the course: Java: Testing with JUnit
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Your first test: HelloJUnit
From the course: Java: Testing with JUnit
Your first test: HelloJUnit
- Great, we're all set. Let's celebrate this by writing our first test. We first need some sort coded tests. So we're going to start with that first. Then we'll add a test class, and write our test, and run it. Let's move over to IntelliJ. I prefer to use IntelliJ, but you can follow along using any setup. I'm going to add the class codes over here. And in this class, I'm going to be writing a very simple method. I'm going to be calling this public, and it's going to return a string. And then say hello as a name. And it won't do anything interesting. It will simply return, hello worlds, like this. We're now going to create a test for a super advanced code. And we're going to start by creating a code test class, in which we can write our tests. So I'm going to click on new Java class in our test Java directory. And I'm going to call this code test. And now we're going to add a test in this test class. And I can…