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)); } }

114 total views, no views today

» Read more