Commit ba08399e authored by Kyle Muldoon's avatar Kyle Muldoon

added TestRunner class

parent 80b6eadd
import org.junit.Test;
import static org.junit.Assert.*;
public class CalculatorTest {
public static void main(String[] args) {
Calculator calculator = new Calculator();
long res = calculator.addTwo(10l, 15l);
assertEquals(res, 25L);
}
}
import org.junit.Test;
import static org.junit.Assert.*;
public class SampleTest {
int a = 10;
int b = 20;
@Test
public void testAdd() {
assertEquals( (a + b), 30 );
}
}
import org.junit.Test;
import static org.junit.Assert.*;
public class TestJUnit {
@Test
public void testSample() {
String str = "JUnit";
assertEquals("JUnit", str);
}
}
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import static org.junit.Assert.*;
public class TestRunner {
public static void main(String[] args) {
Result result = JUnitCore.runClasses(SampleTest.class);
for (Failure failure : result.getFailures()) {
System.out.println(failure.toString());
}
System.out.println(result.wasSuccessful());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment