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

How do I use @ValueSource in JUnit parameterized tests?

In JUnit 5, @ValueSource is used with @ParameterizedTest to run the same test multiple times with different simple literal values. Basic example import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import static org.junit.jupiter.api.Assertions.assertTrue; class StringTest { @ParameterizedTest @ValueSource(strings = {"racecar", "radar", "level"}) void palindromeWordsHaveLengthGreaterThanZero(String word) { assertTrue(word.le...

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

How do I write parameterized tests in JUnit?

In JUnit 5, parameterized tests let you run the same test multiple times with different input values. You use: @ParameterizedTest instead of: @Test Then you provide test data using a source annotation such as @ValueSource, @CsvSource, @MethodSource, or @EnumSource. Basic Example with @ValueSource import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import static org.junit.jupiter.api.Assertions.assertTrue; class NumberTest {...

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

How do I decide what should and should not be unit tested?

Short answer Unit test behavior that you own and that can break, especially logic with branches, rules, edge cases, and important failure paths. Do not unit test code that merely repeats the framework, language, or library behavior unless you add meaningful logic around it. Good candidates for unit tests 1. Business rules If the code […]

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

How do I avoid common mistakes when writing JUnit tests?

Writing JUnit tests is not only about checking whether the code works. Good tests should be clear, reliable, independent, and easy to maintain. Here are common mistakes beginners often make when writing JUnit tests, along with better ways to avoid them. 1. Do Not Let Tests Depend on Each Other Each test should be able […]

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

How do I follow the Arrange-Act-Assert pattern in unit tests?

The Arrange-Act-Assert pattern is a simple way to organize unit tests so they are easy to read and understand. A unit test usually answers three questions: Arrange: What data or objects do I need? Act: What behavior am I testing? Assert: What result do I expect? Basic Structure @Test void methodName_expectedBehavior() { // Arrange // […]

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

How do I write clean and readable JUnit tests?

Clean JUnit tests should be easy to understand, focused on one behavior, and safe to change. A good test should tell you: What scenario is being tested What action happens What result is expected Most Java projects today should use JUnit 5, from the org.junit.jupiter package. 1. Use Clear Test Names A test name should […]

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.