Hello guys, if you are wondering how to test your Spring Boot application then
you are at the right place. In the past, I have shared several Spring and
Spring Boot resources like best Spring boot courses, best Spring Boot books, Spring Boot Interview questions and even Spring Boot projects and in this article, I am going to share
how to test your Spring Boot application using @SpringBoot annotation. This
article will teach you essential concept for testing Spring Boot applications.
It's expected that you are know about essentially the fundamentals of Java,
Maven and Spring Boot (Controllers, Dependencies, Database Repository, and so
on).
Friday, May 19, 2023
Wednesday, April 26, 2023
How to use Mockito to Unit test Java Program with JUnit? Example Tutorial
Hello guys, if you are writing unit test your Java application then you would
have definitely come across JUnit and Mockito, two of the essential unit
testing framework for Java developers. While
JUnit
offers support to run your test, setup and teardown and also assertion to
check the expected and actual output.
Mockito
complements JUnit by offering you a mock based testing approach. Mock is
nothing but a test double which can return a configured value when a certain
method is called. It also provides ability to check if a particular method is
called or not. By using
Mock object
or test double you can check if your code is behaving properly or not in
different scenarios. This is also the key difference between JUnit and
Mockito, JUnit provides infrastructure to run your test while Mockito provide
infrastructure to created Mock objects.
Labels:
JUnit
,
JUnit testing
,
Mockito
Subscribe to:
Posts
(
Atom
)