1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Testing in Java

Connected

Exercise

Digits of a number

Consider the last digit of a number method that we encountered in the previous lesson. This method uses % 10 to grab the last digit of an integer.

Write a PASSING test that illustrates that this method works for a given integer value.

The necessary JUnit packages have been imported for you.

Instructions

100 XP
  • Enter the correct annotation that will enable JUnit to execute this test.
  • Enter the expected last digit of the provided integer.
  • Use the correct JUnit assertion to assert equality between the expected and actual values.