I have a class like this
public class Foo {
public String getData(String id) {
JsonObject json = this.somePrivateMethod(id);
String d = // some manipulation
return d;
}
private JsonObject somePrivateMethod(String id) {
}
}
I am trying to write the unit test for getData
Now, I want to mock this somePrivateMethod
with two jsons
goodJson = {1: 2}, badJson = {"foo" : "bar"}
How do I mock that private method in java.