Unit testing is critical for ensuring your code behaves as expected. JUnit is a popular framework for unit testing in Java.
Source Code
import org.junit.Test;
import static org.junit.Assert.*;
public class SimpleTest {
@Test
public void testAddition() {
assertEquals(2, 1 + 1);
}
}