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
Post a Comment