From the course: Complete Guide To Java Testing with JUnit 5 & Mockito
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Challenge: Write a test class for a email validator
From the course: Complete Guide To Java Testing with JUnit 5 & Mockito
Challenge: Write a test class for a email validator
(upbeat music) - [Instructor] Let's practice writing some tests. In this challenge, you'll create a test class for an email validator. Your tests should ensure it correctly identifies valid and invalid email addresses according to some common rules. These are the common rules. The email should contain exactly one @ character. The set of characters before the @ sign we'll refer to as the local part and the character set after the @ sign we'll refer to as the domain part. The local part can contain letters, digits, dots, hyphens and underscores, but no other types of characters. The domain part should contain at least one dot and should contain letters before and after the dot. We'll refer to these sections as the domain name and top level domain. If digits do exist in the domain part, they should come in the domain name and not the top level domain. No other types of characters should be included. These are a few examples of valid and invalid emails. Let's take a look at each invalid…
Contents
-
-
-
-
-
-
Introduction to parameterized tests in JUnit2m 4s
-
(Locked)
Parameterized tests with EnumSource in JUnit 53m 21s
-
(Locked)
Parameterized tests with ValueSource in JUnit 52m 20s
-
(Locked)
Parameterized tests with CsvSource in JUnit 53m 26s
-
(Locked)
Conditional test execution based on Java version and OS2m 12s
-
(Locked)
Conditional test execution based on environment variables2m 35s
-
(Locked)
Conditional test execution based on custom conditions1m 40s
-
(Locked)
Control test execution with @Order2m 37s
-
(Locked)
Create test suites in JUnit 53m 12s
-
(Locked)
Create a test coverage report with JaCoCo4m 9s
-
(Locked)
Ensure test coverage with JaCoCo5m 41s
-
(Locked)
Execute parallel tests in JUnit 52m 41s
-
(Locked)
Custom extensions in JUnit 54m 40s
-
(Locked)
Challenge: Write a test class for a email validator1m 57s
-
(Locked)
Solution: Write a test class for a email validator5m 32s
-
-
-
-
-
-