How to mock static method in Java?
I have a class FileGenerator , and I'm writing a test for the generateFile() method that should do the following: 1) it should call the static method getBlockImpl(FileTypeEnum) on BlockAbstractFactory 2) it should populate variable blockList from the subclass method getBlocks() 3) it should call a static method createFile from a final helper class FileHelper passing a String parameter 4) it should call the run method of each BlockController in the blockList So far, I have this empty method: public class FileGenerator { // private fields with Getters and Setters public void generateBlocks() { }