Bitsmi Blog

Assertj-DB

01-06-2025 - Antonio Archilla

Introduction

Assertj is a popular Java library that provides useful testing assertions that can be used in test implementations with Junit, TestNG or any other testing library.

Along with Assertj Core, that implement general purpose assertions, Asserj provides other useful modules that provide assertions to be used with data structures provided by other technologies, like Neo4J, Joda Time, Guava…​

This guide is focused on the Assertj-DB module that provides assertions to access a DB and check directly the data stored inside.

To start using Assertj-db it is needed to add the following dependency to the project

<dependency>
  <groupId>org.assertj</groupId>
  <artifactId>assertj-db</artifactId>
  <version>3.0.0</version>
  <scope>test</scope>
</dependency>

3.0.0 is the last version published at the time of writing this guide. It also includes the assertj-core module dependency.

more…

6.- Objects and Data Structures

14-05-2025 - Xavier Salvador

Overview

Chapter 6 explores the fundamental dichotomy between objects and data structures. Objects hide their data and expose behaviour; data structures expose their data and have no significant behaviour. Understanding when to use each is a key skill for building flexible, maintainable systems. The chapter also introduces the Law of Demeter and covers Data Transfer Objects and Active Records.

more…

5.- Format

06-05-2025 - Xavier Salvador

Overview

Chapter 5 establishes that code formatting is about communication – a developer’s first professional obligation. The rules chosen today affect readability and maintainability long after individual lines have changed. The chapter provides concrete guidelines for vertical and horizontal organisation, and closes with the principle that teams must agree on a single formatting standard.

more…

Parameterized tests

04-04-2025 - Antonio Archilla

JUnit provides mechanisms to execute a test multiple times with different input values. Here is a basic quick guide on how to create a more reusable test code base using these capabilities.

more…

Asciidoc - Reference

09-03-2025 - Antonio Archilla

more…

Appendix B.- org.jfree.date.SerialDate

27-02-2025 - Xavier Salvador

Appendix B contains the complete source-code listing of org.jfree.date.SerialDate, taken from the open-source JCommon library. Its presence in the book serves a very specific educational purpose.

more…

Appendix A.- Concurrency II

26-02-2025 - Xavier Salvador

Appendix A, written by Brett L. Schuchert, extends Chapter 13 on concurrency with deeper analysis: a client/server example, possible execution paths, deadlock, and strategies for increasing throughput.

more…

17.- Smells and Heuristics

25-02-2025 - Xavier Salvador

Chapter 17 is the book’s definitive catalogue of smells and heuristics. It collects all the specific reasons that guided the refactorings in the preceding chapters, grouped into seven categories: Comments, Environment, Functions, General, Java, Names, and Tests.

more…

16.- SerialDate refactor

24-02-2025 - Xavier Salvador

Chapter 16 is a case study on the org.jfree.date.SerialDate class from the JCommon library. The author first makes it work correctly, then refactors it in depth, applying a broad catalogue of clean code heuristics.

more…

15.- Internal Aspect of JUnit

23-02-2025 - Xavier Salvador

Chapter 15 examines the ComparisonCompactor class from the JUnit framework in depth, demonstrating how to apply Clean Code rules to an already well-written module using the Boy Scout principle: leave the code better than you found it.

more…

results matching ""

    No results matching ""