Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
PILIHAN EDITOR
Java

Memahami Java Stream: olah koleksi dengan lebih ringkas

Pelajari alur filter, map, dan collect untuk mengolah data Java dengan kode yang mudah dibaca.

D Tim Diary Coding · 1 menit baca
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

JUNIT / CATATAN</>
JUnit13 Jul 2026

How do I understand JUnit Platform, Jupiter, and Vintage?

If you are learning modern Java testing, the words JUnit Platform, JUnit Jupiter, and JUnit Vintage can be confusing at first. They sound like three different testing frameworks, but they are really three parts of the JUnit 5 ecosystem. The short version is: JUnit Platform runs tests. JUnit Jupiter is the modern JUnit 5 programming […]

Wayan · 10 menit baca
JUNIT / CATATAN</>
JUnit13 Jul 2026

How do I test Collections, Lists, Maps, and Sets in JUnit?

Testing Collections in JUnit In JUnit, you usually test collections with assertions such as: assertEquals assertTrue assertFalse assertIterableEquals assertArrayEquals assertThrows If you are using JUnit 5, import assertions from: import static org.junit.jupiter.api.Assertions.*; 1. Testing a List Use assertEquals when order matters. import org.junit.jupiter.api.Test; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.j...

Wayan · 6 menit baca
JUNIT / CATATAN</>
JUnit13 Jul 2026

How do I compare objects in JUnit tests?

In JUnit tests, you usually compare objects with assertions, not with ==. The most common choices are: assertEquals(expected, actual) — compares objects using their equals() method. assertSame(expected, actual) — checks whether both references point to the same object. AssertJ’s assertThat(actual).isEqualTo(expected) — a more fluent alternative. Field-by-field assertions — useful when you only care about some […]

Wayan · 4 menit baca
JUNIT / CATATAN</>
JUnit13 Jul 2026

How do I use AssertJ with JUnit for better assertions?

You can use AssertJ with JUnit to write more readable, fluent assertions than standard JUnit assertions. 1. Add AssertJ Dependency If you use Maven: <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> <version>3.26.3</version> <scope>test</scope> </dependency> If you use Gradle: testImplementation("org.assertj:assertj-core:3.26.3") 2. Use AssertJ in a JUnit Test Import assertThat statically: import org.junit.jupiter.api.Test; import static org.as...

Wayan · 3 menit baca
JUNIT / CATATAN</>
JUnit13 Jul 2026

How do I test repository-like classes without a real database?

You can test repository-like classes without a real database by replacing the database dependency with a fake, mock, or in-memory implementation, depending on what you want to verify. 1. Use mocks for unit tests If your class depends on a repository interface, mock it and verify behavior without touching a database. Example with JUnit 5 […]

Wayan · 4 menit baca
JUNIT / CATATAN</>
JUnit13 Jul 2026

How do I test service classes with JUnit and Mockito?

Testing Service Classes with JUnit and Mockito Service classes are usually where your business logic lives. They often depend on repositories, clients, mappers, validators, or other services. When unit testing a service, the goal is usually: test the service logic itself mock external dependencies avoid starting the Spring container unless necessary verify returned values, exceptions, […]

Wayan · 8 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.