What is the best way of writing a unit test for a method, such as my setProperties (see below), that uses a private  configuration variable (config). I tried but failed to override it using reflection and Makito, but without success. I realize that changing the design to make the code easier to test is best, but I want to created some unit tests before I refactor the code.
public class MainClass {
    private final java.lang.String config = "app.properties";
    public TestClass() {
        try {
            setProperties();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public void setProperties() throws Exception {
        try {
            InputStream input = new BufferedInputStream(new FileInputStream(config));
            ..
            ..
        } catch (Exception exception) {
            throw exception;
        }
    }
}
 
     
     
     
    