Browsed by
Tag: junit

Junit Test case sample

Junit Test case sample

Step 1: Java code package com.math; public class AgnClass { public int Sum(int x, int y) { return x + y; } } Step 2: Junit Test case for the above Java code package com.math; import org.junit.Test; import static org.junit.Assert.assertEquals; public class AgnClassTest { @Test public void testSum() { AgnClass nav = new AgnClass(); assertEquals("Result", 15, nav.sum(10, 5)); } } Step 3: Right click on the AgnClassTest program and run as junit, then by means of green color indication we…

Read More Read More

447 total views, no views today