@Test
The annotation @Test identifies that a method is a test method.
Denotes a test method. Can be used with expected to assert expected results on the object under test.
package myWorkjUnit; import org.junit.Test; public class firstjunitprogram { @Test public void Divide() { System.out.println("Result - " + divide(10, 5)); } @Test public void substraction(){ System.out.println("Result - " + substraction(10, 5)); } @Test public void Addition(){ System.out.println("Result - " + addition(10, 5)); } public int divide(int x, int y) { return x / y; } public int addition(int x, int y) { return (x+y); } public int substraction(int x, int y) { return (x-y); } }
Reference Link 1