Pick all the tests (assertions) that will pass. assertEquals(3, 1 + 2); assertEquals(0.3, 0.1 +0.2); assertEquals("Messa
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Pick all the tests (assertions) that will pass. assertEquals(3, 1 + 2); assertEquals(0.3, 0.1 +0.2); assertEquals("Messa
Part 2
Part 3
Pick all the tests (assertions) that will pass. assertEquals(3, 1 + 2); assertEquals(0.3, 0.1 +0.2); assertEquals("Message", "My message", "My message"); assertEquals(0.3, 0.1 +0.2, 0.01); assertEquals("My message", "My message", "Message");
Pick all true statements about Test-driven development (TDD). You should focus on running tests that will test the whole app (from backend to frontend). You should modularize your code and focus on testing each individual compounent/method. There is no need to test unusual/invalid user input since they will rarely happen. You should write test(s) first, then try to implement method(s) to pass those tests.
Write a JUnit testing method that tests a static method in MyClass called "average", which takes in two double and returns the average of them in double. You are NOT required to implement "average"! Just write a method that can test "average". 1 test case is enough. You don't need to worry about importing packages, etc. You can even eliminate the header of your testing method, which is annotated with @Test: @Test public void testAverageMethod() { // Your code here } Here are the rubrics: • +0.1 as long as you wrote something; • +0.1 correct expected value based on your test case; • +0.2 correct assert statement; • +0.2 no syntax error in other statements
Write a JUnit testing method that tests a static method in MyClass called "average", which takes in two double and returns the average of them in double. You are NOT required to implement "average"! Just write a method that can test "average". 1 test case is enough. You don't need to worry about importing packages, etc. You can even eliminate the header of your testing method, which is annotated with @Test: @Test public void testAverageMethod() { // Your code here } Here are the rubrics: • +0.1 as long as you wrote something; • +0.1 correct expected value based on your test case; • +0.2 correct assert statement; • +0.2 no syntax error in other statements