Mocked Dependency Object Is Null After Using Mockito @InjectMocks Annotation

Let me explain the problem first. We have a Java class under test. We are using Junit with Mockito framework to write the unit test cases.We have annotated our test class with @InjectMocks annotation as below: @InjectMocks private TestClass testClass; @Mock private Dependency1 dependency1; @Mock private Dependency2 dependency2; That should inject mocked dependencies to the … Read more

How to Run PIP Command with Specific Python Version

This question has been answered online in multiple places. I want to highlight few challenges faced while running pip command with multiple versions of Python installed in the operating system & my preferred way of doing it.I have an old machine with Ubuntu 16.04. By default Ubuntu 16 has Python 2.7 and Python 3.5. So … Read more

Signing JWT Token With JWK Private Key Using PyJWT

JWK is a JSON that represents a cryptographic key. PyJWT is a pretty popular Python library to generate, verify JWT token. But one drawback is that it doesn’t support JWK format, at least it is not properly documented. Suppose we have an RSA private key, but it is given in JWK format. Our objective is … Read more

LeetCode 22. Generate Parentheses Java Solution And Time Complexity Explanation

Generating all possible combinations of balanced parentheses is a common interview problem & is found in websites like LeetCode & GeeksForGeeks.Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. We are using backtracking to solve this problem. There are two cases where we can proceed to the next recursive … Read more

How to Download Death Rally for Free?

I loved Death Rally. Those of you who don’t know what I am talking about, it is a top-down racing game from the 90s developed by Remedy Entertainment. Anyways, if you are here & reading through the post, then I assume you already know what I am talking about & how good the game was. … Read more