
Set up a new Maven project in IntelliJ using the quick start archetype. Add JUnit and Mockito dependencies, enable auto-import, and create a test to verify a list operation.
Learn to run your first JUnit test using the test annotation, verify outputs with assert methods, and explore before/after and before class/after class annotations, plus ignore for selective tests.
Create a calculate test class named CalculateTest and a calculator class, annotate a test method with @Test, and use assertions to verify the calculator's result, keeping one test per unit.
Demonstrate assert equals and not equals by adding a calculator add method and validating 1+1 equals 2 and 1+2 equals 3 with JUnit. Run class tests to confirm tests pass.
Learn how to assert true and false in JUnit using primitive comparisons. Verify that one plus two equals three with a calculator example, and see how the equals method behaves.
Assert notNull checks for calculator objects, and run the test suite frequently at method and class levels to catch regressions and keep the red-green refactor cycle tight.
Learn how to assert exceptions in JUnit using the expected attribute, test annotations, and runtime exceptions. Validate behavior with negative inputs, ensure other tests still pass, and run regression tests.
Explore using try-catch to verify exceptions in JUnit tests, instead of the expected exception annotation, showing how asserts in the catch can signal a passing test and when to fail.
Explore using Hamcrest matchers like equalTo with static imports to write expressive JUnit tests, and learn to chain expressions for readable, flexible test intent.
Describe how the @Before annotation runs before each test to initialize a new calculator instance, ensuring a clean state by avoiding persistent class-level data.
Explains the JUnit @After annotation, which runs after each test method to perform cleanup, such as clearing data or deleting files, and demonstrates its use alongside setup and before annotations.
An overview of using @BeforeClass and @AfterClass annotations, which are public static methods that run once per class to set up and tear down databases or services.
Learn how to use the ignore annotation to skip a failing test, keeping the build green while you fix it, and understand its effects on test counts.
Learn to implement a JUnit exercise solution by writing a vehicle class with a color constructor and tests that verify blue color and not red, using before and after annotations.
Learn how to use a mock to provide a dummy implementation of an interface, define outputs, and verify method calls in unit tests.
Stub a mock ad service in your calculator tests using when-thenReturn to control its output. Inject the mock in setup and assert the result with JUnit.
Learn to verify a mock in a test by using verification and static imports to confirm a mocked service is called once with a given input and returns a result.
Learn how to verify a mock using verify method, including argument matches and invocation counts with the times method, never, in order, and verify at least and at most.
Learn basic mock verification with Mockito and JUnit by ensuring a mock calculator service is called with 3 and 2 and returns 1.
Learn basic verification of a calculator service using Mockito and JUnit by ensuring the minus method is called with 3 and 2 and returns 1 through a mocked calculate service.
Learn how to verify method calls in Mockito and JUnit using argument matchers, including any and specific values, to confirm strings or ints were passed.
Learn to verify the number of invocations in Mockito by asserting that a method was called twice, using overloaded verify methods and static imports to confirm call counts.
Master verifying method calls with Mockito by ensuring the add method is never invoked on the calculator service, using static imports to assert call counts.
Learn to verify the order of invocations on a mock calculator service using InOrder in Mockito, ensuring add occurs before minus.
Explore verifying method invocations with at most and at least counts in Mockito for Java, including at least once, at least twice, and at most twice.
Learn Mockito stubbing basics with when and then return, explore argument matches and consecutive calls, and compare spying versus mocking with a spying example.
Learn basic stubbing of mocks in Mockito for Java for beginners, using argument matches like any int, returning 1000, and verifying that add was called with any int, twice.
Learn stubbing with argument matchers in Mockito for Java, using any and any int to stub returns and verify method calls.
Learn to stub consecutive calls in Mockito for Java by chaining when-thenReturn to return 1000 on the first call and 100 on subsequent calls for any input, with assertions.
Learn how doReturn() provides an alternative to when-then-return for stubbing in Mockito, with practical examples and guidance on when to use it, including spying scenarios.
Use doThrow to configure a mock to throw a one-time exception when the calculate service's add method is called, exercising exception handling and boosting code coverage.
Learn to stub void methods using doAnswer on a mock, verify passed arguments, and handle void method calls in tests.
Learn to stub with do nothing for void methods, sequencing a reset call so the first invocation does nothing and the second throws an exception in your test.
Learn how to use Mockito and JUnit in Java for beginners, including stubbing with doCallRealMethod, understanding mocks and spies, and invoking real methods on a mock.
Demonstrates that mocks are dummy objects with no behavior unless stubbed, while spies wrap real objects and allow selective stubbing of methods on a concrete class.
Demonstrate using a spy object in Mockito, showing how a spy can be stubbed while remaining a concrete object. Override specific methods and compare spying with mocking.
Capture values from mock method calls using argument capture, then verify and assert the first and second inputs to ensure correct parameter passing.
Learn how to reset mocks in unit tests to run fresh interactions on a new instance, verify call counts, and confirm zero interactions after a reset.
Learn how to speed up test development with mock and spy annotations in Mockito, replacing manual mock creation and simplifying setup for cleaner unit tests.
Review essential JUnit annotations and asserts, and apply them with Mockito mocking. Learn Mockito verification with verify methods and master stubbing using when-then and do methods.
In this course I take you through the full process of Mockito and JUnit and how to use it which will get you up to speed quickly.
We'll cover the basic fundamentals of Mockito and JUnit by going through examples of real code to give you a solid understanding of the frameworks.
The course aims to take complete beginners through everything thats needed in Mockito and JUnit from IDE setup to working through examples.
This course will help get you quickly up to speed in one of the most overlooked but essential areas of Java development which features highly in job requirements and is commonly featured in first and second stage interviews.