JUnit and Mockito Unit Testing for Java Developers [Video]
Video
Video
$39.99
Subscription
$15.99
$10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with Video + Subscription?
Download this video in MP4 format, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
What do I get with Print?
Get a paperback copy of the book delivered to your specified Address*
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do I get with Print?
What do you get with video?
What do you get with video?
What do you get with Audiobook?
What do you get with Exam Trainer?
Video
$39.99
Subscription
$15.99
$10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with Video + Subscription?
Download this video in MP4 format, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do I get with Print?
Get a paperback copy of the book delivered to your specified Address*
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do I get with Print?
Get a paperback copy of the book delivered to your specified Address*
Access this title in our online reader
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
-
Free ChapterIntroduction
-
Unit Testing Foundations
-
Creating a Java Project Using JUnit
-
Writing and Running Unit Tests with JUnit and IntelliJ IDEA
- Section Introduction
- Creating a Test Method with @Test Annotation
- Running a Unit Test Within the Integrated Development Environment (IDE) and Understanding Test Success
- Understanding Test Failures with Exceptions
- Failing a Unit Test Explicitly with Assert.Fail()
- Using Assert.Fail() to Check Validation Logic in a Try/Catch
- Introduction to the JUnit Assertions API
- Structuring Unit Tests with Arrange-Act Assert
- Understanding the Execution of Assertions and JUnit's Fail-fast Test Failure Mechanism
- Adding Descriptive Comments to Assertions and Test Failures to Aid Diagnostics
- Coding a Unit Test Following Arrange-Act-Assert
- Keeping Test Setup (Don't Repeat Yourself) DRY with @Before
- Understanding Test Fixture Instantiation
-
Using Testing with Mock Objects and Mockito
- Section Introduction
- What Is Mockito and What Are Mock Objects?
- Introduction to Testing with Mock Objects
- Configuring Projects Using Mockito
- Creating a Project Which Uses JUnit and Mockito
- Coding a Layered Architecture - Presentation Layer
- Coding a Layered Architecture - Business Layer
- Coding a Layered Architecture - Persistence Layer
- Putting the Correct Packages in Place to Respect the layering
- Writing a Test for the Login Controller in the Presentation Layer
- Understanding the Test Fixture Setup While Writing Mock Object-based Unit Tests
- Writing a Test for the Authentication Service in the Business Layer
- Thinking about Design Decisions When Unit Testing
-
Looking at Hamcrest Assertions Library
- Section Introduction
- Evolving the Domain and Repository Classes
- Ignoring Tests with @ignore
- Implementing a Finder in the Repository
- Implementing Business Logic in the Service
- Configuring Maven to Use Java 8
- Evolving the Repository Class
- Adding a Parameter-driven Finder to the Service
- Refactoring to Evolve a New Service
- Generating Test Methods in the IDE and Toggling Between Production and Test Code
- Introducing the JUnit Mockito Runner and @Mock
- Analyzing the Production Code to Determine How to Write the Arrange Section
- Using Mockito's @InjectMocks to Create the System Under Test with its Dependencies
- Keep Yourself Motivated by Checking the Happy Path Test Output
- Using the JUnit Assertions API to Write the Assert Section
- Thinking about the Weaknesses of the JUnit Assertions API
- Importance of Checking Your Work as You Go!
- Upgrading a JUnit Project to Use the Full Hamcrest Version
- Replacing JUnit Assertions with Hamcrest Assertions and Using Assertions with Collections
- Understanding and Reading Hamcrest Test Failures
- Quick Thoughts on Hamcrest Individual vs Collection Assertions
- Do Not Invoke Unneeded Production Code in Your Test Classes
- Understanding Evaluation of Hamcrest Matchers
- Thinking about Keeping Production Code to a Minimum in Tests
- Creating Complex Hamcrest Assertions with allOf Method and Property Matchers
About this
video
Are you looking for a simple, no-nonsense guide to learning how unit testing works? This video course is what you need. Complete with hands-on exercises and best practices, this guide will help you to understand JUnit and Mockito unit testing with ease.
The course starts with an introduction to unit testing and highlights the need and importance of its testing framework, JUnit. You’ll then understand the project structure and conventions by creating a Java project using JUnit. As you implement best practices for writing and running unit tests with JUnit and IntelliJ IDEA, you’ll discover how JUnit works. You’ll also write mock objects-based unit tests with Mockito for testing a simple layered architecture. Finally, you’ll learn to make more powerful assertions in your unit tests by harnessing the power of the Hamcrest assertions library that ships with JUnit.
By the end of this course, you’ll have developed the skills needed for writing better unit tests using JUnit, Mockito, and Hamcrest.
"All the resources and support files are available at https://github.com/PacktPublishing/JUnit-and-Mockito-Unit-Testing-for-Java-Developers
- Publication date:
- October 2020
- Publisher
- Packt
- Duration
- 2 hours 56 minutes
- ISBN
- 9781801078337