I have a not so good legacy code involving in using the method of a private static class I was wondering if the method in such class can be called. Which I was writing test for. I know it can be done with reflection if this was a method but it isnt.
public class FiscalReport implements Report
{
private void readProductValueClass()
{
Connection dbc = null;
Statement st = null;
ResultSet rs = null;
String q = null;
try
{
dbc = db.getConnection();
dbc.setAutoCommit(false);
st = dbc.createStatement();
routerClassMap = new HashMap();
q = "SELECT * FROM sales_report";
rs = st.executeQuery(q);
while(rs.next())
{
ProductValueClassrc = new ProductValueClass(); // <---this new class
// is where it gets called...
.....
}
private static class ProductValueClass
{
public String name;
public String emp;
public String sale;
public String option;
public String value;
public Query q;
public Query qr
public Query sql;
public String toString()
{
return
"[" +
name + ", " +
emp + ", " +
sale + ", " +
option + ", " +
values +
"]";
}
public Query query()
{
return q.add(q(notEqual(qr)? null: sql));
}
}
}