Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
25.11. Parameterized Tests
This section
Practice test
10 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
2 cards from this lesson. Good the night before a test.
Try these first
- 1.
What annotation do you use for a parameterized test?
Hint
Think about which annotation indicates a test runs multiple times.
- 2.
Name a source annotation that can provide parameters for a test.
Hint
Consider what type of source can provide single arrays of values.
- 3.
What does @ParameterizedTest do in JUnit?
- Runs a test only once
- Runs a test multiple times with different parameters
- Runs multiple tests simultaneously
Hint
Remember how parameterization allows multiple values.
- 4.
True or False: Parameterized tests are only useful for numerical data.
- True
- False
Hint
Consider the applications of parameterized tests beyond just integers.
- 5.
Create a parameterized test using @CsvSource to check for valid email formats.
Hint
Consider how you would define valid and invalid email scenarios.
- 6.
Design a parameterized test for a method that checks for palindromes with a variety of inputs.
Hint
Think about what constitutes a palindrome, and how string manipulation can validate it.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
Get your answers marked and your progress tracked
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting