java - unit testing static methods using powermock -


i want write unit test case of static methods in project,

snippet of class code,

class util{   public static string getvariablevalue(string name)   {      if(iswindows()){        return string...      }      else{        return other string...      }   }    public static boolean iswindows(){     if(os windows)        return true;     else       return false;    }  } 

basically, want write unit test case getvariablevalue() when iswindows() returns 'false'. how write using powermock?

// way tell powermock mock static methods of // given class powermock.mockstaticpartial(util.class,"iswindows");  expect(util.iswindows()).andreturn(false);     

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -