JUnit Testing Framework

Overview

Qualified supports writing tests for Java using JUnit 4.

Basic Example

Solution

public class Calculator {
    public static int add(int a, int b) {
        return a + b;
    }
}

Tests

import org.junit.Test;
import static org.junit.Assert.assertEquals;

public class CalculatorTest {
    @Test
    public void testAddingTwoNumbers() {
        int actual = Calculator.add(1, 2);
        int expected = 3;
        assertEquals(expected, actual);
    }
}

Learn More

You can learn more on the JUnit website.