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</>
JUnit12 Jul 2026

How do I run only selected JUnit tests by tag?

To run only selected JUnit 5 tests by tag, mark your tests with @Tag, then configure your build tool or IDE to include only that tag. 1. Add tags to your tests import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; class PaymentServiceTest { @Test @Tag("fast") void calculatesTotal() { // test code } @Test @Tag("integration") void connectsToPaymentGateway() { // test […]

Wayan · 2 menit baca
JUNIT / CATATAN</>
JUnit12 Jul 2026

How do I use tags to group JUnit tests?

In JUnit 5, you can use the @Tag annotation to group tests into categories such as: fast slow unit integration database api smoke Tags are useful when you want to run only certain groups of tests, for example only fast unit tests during development, or only integration tests in a CI pipeline. 1. Basic Example […]

Wayan · 5 menit baca
JUNIT / CATATAN</>
JUnit11 Jul 2026

How do I use @EnumSource to test enum values?

@EnumSource is a JUnit 5 parameterized-test source that runs the same test once for each selected enum constant. Basic usage import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; import static org.junit.jupiter.api.Assertions.assertNotNull; class DirectionTest { enum Direction { NORTH, SOUTH, EAST, WEST } @ParameterizedTest @EnumSource(Direction.class) void shouldTestAllDirections(Direction direction) { assertNotNull(direction...

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

How do I use @MethodSource for dynamic test data?

In JUnit 5, @MethodSource lets you supply test arguments from one or more factory methods. It is commonly used with @ParameterizedTest when your test data is too complex for @ValueSource or @CsvSource. Basic example import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.assertTrue; class StringTest { @ParameterizedTest @MethodSource("blankStrings")...

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

How do I use @CsvFileSource to load test data from a file?

Use JUnit 5’s @CsvFileSource with a parameterized test to load rows from a CSV file and pass each row into your test method. 1. Add the CSV file Place the CSV file under src/test/resources, for example: src/test/resources/test-data/users.csv Example CSV: username,age,active alice,30,true bob,25,false charlie,40,true 2. Use @CsvFileSource import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvFileSource; import static org.junit.jupiter.a...

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

How do I use @CsvSource in JUnit parameterized tests?

To use @CsvSource in JUnit 5 parameterized tests, you define multiple sets of comma-separated input values directly inside the annotation. Each CSV row becomes one test invocation. 1. Add the Required Imports import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import static org.junit.jupiter.api.Assertions.assertEquals; @CsvSource is part of JUnit Jupiter Params, so make sure your project includes the parameterized test […]

Wayan · 3 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.