Junit testing for a boolean method

后端 未结 3 1728
一个人的身影
一个人的身影 2021-01-12 02:11

I have problem writing a testcase to this method below: EvenNum(double)

public class OddEven {

/**
 * @param args
 */

public boolean evenNum(d         


        
3条回答
  •  一整个雨季
    2021-01-12 02:41

    Two things :

    • You are invoking a non-static method statically. The method should be declared static:

      public static boolean evenNum(double num) {

      }

    • You didn't type the name of the method correctly. Look closely. Also consider renaming it something more readable like, isEven(...)

提交回复
热议问题