From the course: Java for All Platforms: Desktop, Web, and Mobile Development

Unlock the full course today

Join today to access over 23,500 courses taught by industry experts.

Running unit tests

Running unit tests

- [Instructor] With our test class created, let's write some unit test. Remember, the goal is to confirm that this code that we wrote does what we claim it does. Let's go over to our test class inside of the ad numbers test. And then we're going to create an instance of number helper. So we'll just call it number helper and we'll set it equal to a new number helper. From there, we're going to call assert equals. And with this method, we provide two values. One integer is going to be the expected value, then the next parameter is going to be the actual value. So in expected, let's put one and then for actual we'll call number helper, add numbers and then we're going to put some kind of value that's supposed to add up to one. Let's just put zero and one. At this point, we can actually run the test. This button right here, will run all of the tests in the class and then this button will run one test at a time. So either…

Contents