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

How do I use assertions in JUnit?

In JUnit, assertions are used to verify that your code produces the expected result. If an assertion fails, the test fails. JUnit 5 assertions are provided by the org.junit.jupiter.api.Assertions class. Basic Example import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; class CalculatorTest { @Test void testAddition() { int result = 2 + 3; assertEquals(5, result); } } In […]

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

How do I use @Test in JUnit?

Using @Test in JUnit In JUnit, @Test is an annotation that marks a method as a test method. When you run your tests, JUnit looks for methods annotated with @Test and executes them automatically. 1. Add the Correct Import For JUnit 5, use: import org.junit.jupiter.api.Test; You will usually also import assertions such as: import static […]

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

How do I understand the basic structure of a JUnit test class?

A basic JUnit test class is just a Java class that contains one or more test methods. Each test method checks whether a small piece of code behaves the way you expect. Here is a simple JUnit 5 example: import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class CalculatorTest { @Test void shouldAddTwoNumbers() { int result = 2 […]

Wayan · 4 menit baca
GRADLE / CATATAN</>
Gradle07 Jul 2026

How do I add JUnit to a Gradle project?

To add JUnit to a Gradle project, add the JUnit dependency to your build.gradle or build.gradle.kts file and configure Gradle to use the JUnit Platform. If you use Groovy Gradle: build.gradle For JUnit 5, add: plugins { id 'java' } repositories { mavenCentral() } dependencies { testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2' } test { useJUnitPlatform() } If you […]

Wayan · 1 menit baca
JUNIT / CATATAN</>
JUnit07 Jul 2026

How do I add JUnit to a Maven project?

To add JUnit to a Maven project, you add the JUnit dependency to your project’s pom.xml, create test classes under src/test/java, and run the tests with Maven. 1. Add JUnit to pom.xml For modern Java projects, use JUnit 5. <dependencies> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> <version>5.13.4</version> <scope>test</scope> </dependency> </dependencies> If your pom.xml already has a <dependencies> section, […]

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

How do I start unit testing in Java with JUnit?

Unit testing in Java means testing small pieces of code — usually one method or one class — in isolation. The most common testing framework for modern Java projects is JUnit 5, also known as JUnit Jupiter. This guide shows the basic steps to start writing unit tests with JUnit. 1. Add JUnit to Your […]

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