Mockito

How To Perform UNIT TESTING using Mockito Framework :-

Reading Time: 4 minutes While working on a code we intend to make it functional. But it is equally important that we make sure our code works the way we intended it to. And we can achieve that by witting unit test cases. In this blog, we will cover the same by considering two testing scenarios. First, where the method is independent. Second, where it is dependent on some Continue Reading

Mockito Framework: How it works

Reading Time: 3 minutes Introduction Mockito is a popular mocking framework that is useful to test the written code. It enables to write the essential test cases for real-world projects and applications. Unit Testing: It is a software testing technique to test the unit of a code that can be logically isolated in a system. Unit: It is referred to as an individual functionality of a program. Mocking: It is Continue Reading

Unit testing with Mockito Framework

Reading Time: 3 minutes In this blog, we are going to learn about how we can use mockito framework to perform unit testing. Mockito framework provides us several methods which we can use to perform unit test. What is Unit Testing Unit testing is a software testing technique in which we only test a single component of the software. We ignore the output of the dependent module and test Continue Reading

Unit testing void methods with Mockito and JUnit

Reading Time: 3 minutes Writing functionality is the main focus whenever we are writing a software program, but it is equally important that we make sure our code works the way we intended it to. And how do we do that? By writing unit test cases. They are used to test the smallest functionality of code. Unit test cases are an essential part of software development. In this blog, Continue Reading

Mocking The Right Way

Reading Time: 3 minutes Mockito is a fun way to perform unit tests, but it’s true potential can only be realised if the underlying layers are designed in such a way that there is no interaction with the internal logic of other components of the application.

Beginners Guide for Mocking in Scala

Reading Time: 3 minutes We all must know how the unit test cases are one of the most important part of an application. If not? Then I must tell you that unit testing is one of the earliest testings which is performed on the unit of code and the earlier the defects are detected, the easier it is to fix. It reduces the difficulties of discovering errors contained in Continue Reading

Mocking static methods with PowerMock

Reading Time: 2 minutes A good developer always writes a unit test case for his/her code. While writing test cases, we came across various types of scenarios, including the one where we need to mock static methods. One of the common examples of such scenario is where our service is using some static methods from a third party library. Here, one way to deal is to have an adapter Continue Reading

Generating, visiting and unit testing grammar using ANTLR4 with Java and Scala

Reading Time: 6 minutes “Quality is free, but only to those who are willing to pay heavily for it” – T. DeMarco Now unit testing is not that heavy to pay off so lets start the blog. In this blog we will be continuing the voyage to the kingdom of ANTLR4 RECAP In previous blog we discussed how to test whether a string is grammatically correct or not using Continue Reading

Mock Unit Testing using Mockito in Play Scala project

Reading Time: 2 minutes During Unit Testing in a Play Scala project, there arises a need to Mock certain Objects or Traits which are used in the unit, so that the unit being tested has a consistent interaction with its outside dependencies. But due to tight coupling or external dependencies, objects cannot be tested as a unit. So, we need to mock those external dependencies by adding fake external Continue Reading