Author: Editorial Team
-
Replacing Stubs with Mocks for Cleaner Unit Tests
In the previous step, we explored how to write unit tests using stub implementations. While stubs work for small scenarios, we saw that they become hard to manage and maintain as the complexity of tests grows. 1. What is Mockito? Mockito is a mocking framework for Java. Mockito allows convenient creation of substitutes of real…
-
Testing Business Logic with Dependencies and Stubs
In our previous tutorial, we built a simple business logic component using JUnit 5 and observed how real-world applications often involve dependencies like external services. This step is about unit testing such dependencies—first using a stub before we learn how to use Mockito in later lessons. 1. From Simple Input to Service-Driven Logic Previously, we…
-
JUnit 5 Tutorial: Writing Your First Unit Test Before Introducing Mockito
Unit testing is the foundation of reliable software development. Before exploring advanced mocking frameworks like Mockito, it’s crucial to understand how to write basic unit tests with JUnit 5. 1. Create a Simple Business Class Let’s create a simple class called SomeBusinessImpl that contains a method to calculate the sum of integers in an array.…
-
Transformers in Machine Learning – An Introduction
Transformers have become the backbone of modern machine learning models, especially in Natural Language Processing (NLP). From Google’s BERT to OpenAI’s GPT, transformers power state-of-the-art models used for text classification, translation, question answering, and even image processing. Introduced in the 2017 paper “Attention Is All You Need” by Vaswani et al., Transformers address limitations of…
-
Understanding List Data Type
What is a List? A list in Python is a collection data type that allows you to store multiple values in a single variable. These values can be of any type: integers, strings, floats, booleans, or even other lists. When Should You Use a List? Use a list when: List Characteristics Feature Description Ordered Yes.…
-
Understanding Immutability in Python’s Fundamental Data Types
In this tutorial, we will explore a foundational and powerful concept in Python programming: immutability, especially with respect to fundamental data types. This topic is essential for understanding how Python manages memory, variable assignment, and object behavior. Fundamental Data Types Before diving into immutability, let’s first recall the fundamental (primitive) data types in Python: All…
-
Data Compression in React While Calling APIs
Introduction In modern web applications, especially those built with React, the volume of data transmitted between the frontend and backend can significantly impact performance. To reduce the size of HTTP requests and responses, data compression can be applied. What is Data Compression? Data compression is the process of encoding information using fewer bits. It reduces…
-
Namespace in Kubernetes
Introduction Kubernetes is a powerful container orchestration platform, and as clusters grow in size and complexity, it becomes essential to logically separate resources for different teams, environments, or applications. This is where Namespaces in Kubernetes come into play. Namespaces provide a mechanism for isolating groups of resources within a single Kubernetes cluster. What is a…
-
Debouncing in React – An Example
What is Debouncing? Debouncing is a technique to control the rate at which a function is executed. It ensures that the function is triggered only after a specified amount of time has passed since the last event. This means if the event is triggered again within the wait time, the timer resets. It is especially…
-
Java Collection Framework – An Introduction
1. Introduction The Java Collection Framework (JCF) is a unified architecture for storing and manipulating groups of data. It provides a set of interfaces and classes that support a wide variety of data structures including lists, sets, queues, and maps. Collection Framework Hierarchy (Textual Diagram) 2. Core Interfaces and Classes 2.1 Collection Interface 3. List…
