Consider the following JUnit 4 test code: @RunWith(Theories….
Consider the following JUnit 4 test code: @RunWith(Theories.class)public class TheoryTest { @DataPoints public static double[] nums = {1.0, 2.0, 3.0}; @Theory public void squares(double num1, double num2) { }} How many times is the @Theory (squares) method executed?
Read DetailsGiven the JUnit 4 test below: @Test(expected = Ind…
Given the JUnit 4 test below: @Test(expected = IndexOutOfBoundsException.class) public void testIndex() { List list = new ArrayList(); list.add(“apple”); list.add(“orange”); list.get(4); } Which of the following is/are true (select all correct answer(s) and no incorrect answer(s) to get credit):
Read DetailsWhat is the console output of running the following JUnit 4…
What is the console output of running the following JUnit 4 test? public class HelloWorldTest { @Before public void before() { System.out.println(“before”); } @Test public void test() { int[] expected = {}; int[] actual = null; System.out.println(“asserting…”); assertArrayEquals(expected, actual); System.out.println(“done asserting”); } @After public void after() { System.out.println(“after”); } }
Read Details