java - What are other aspects of JUnit testing? -


i'm tasked creating junit test functional code. junit test works on system fine, in auto-grader apparently wrong.

classes without full coverage:     ------------------------------     ran 0 out of 10 lines in edu.buffalo.cse116.uniquesum (note: lines in failed junit tests count not run) 

i've looked on , can't find i'm doing wrong. told test should check every line in code "100%" , , does. when myself put in errors in code junit test notice it, atleast on system.

sample code:

 /**    * normally, method compute sum of 3 parameters. but, if 1 of parameters has same    * value parameter, neither of parameters should included in sum. if 3 parameters    * have same value, 0 should returned.    *    * @param first parameter use in "unique sum" calculation    * @param b second parameter use in "unique sum" calculation    * @param c third parameter use in "unique sum" calculation    * @return "unique sum" sums values appear once in 3 parameters.    */   public int computeuniquesum(int a, int b, int c) {     if (a == b) {       if (a == c) {         return 0;       } else {         return c;       }     } else if (a == c) {       return b;     } else if (b == c) {       return a;     } else {       return + b + c;     }   } } 

my junit test:

package testing; import static org.junit.assert.assertequals; import org.junit.test; public class uniquesumtest {       @test     public void assert1() {          uniquesum computetest = new uniquesum();         int actual = computetest.computeuniquesum(3, 3, 3);          assertequals("all paramters cannot have same value.", 0, actual);      }       @test     public void assert2() {          uniquesum computetest = new uniquesum();         int result = computetest.computeuniquesum(4, 3, 3);          assertequals("any paramters cannot have same value.", 4, result);     }      @test     public void assert3() {          uniquesum computetest = new uniquesum();         int result = computetest.computeuniquesum(3, 4, 3);          assertequals("any paramters cannot have same value.:", 4, result);     }      @test     public void assert4() {          uniquesum computetest = new uniquesum();         int result = computetest.computeuniquesum(3, 3, 4);          assertequals("any paramters cannot have same value.", 4, result);     }      @test     public void assert5() {          uniquesum computetest = new uniquesum();         int result = computetest.computeuniquesum(5, 10, 15);          assertequals("all parameters different.", 30, result);     } } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -