I have a class that has a big method that calls on a lot of private methods. I think I want to extract those private methods into their own classes for one because they contain business logic and I think they should be public so they can be unit tested.
Here's a sample of the code:
public void handleRow(Object arg0) {
if (continueRunning){
hashData=(HashMap<String, Object>)arg0;
Long stdReportId = null;
Date effDate=null;
if (stdReportIds!=null){
stdReportId = stdReportIds[index];
}
if (effDates!=null){
effDate = effDates[index];
}
initAndPutPriceBrackets(hashData, stdReportId, effDate);
putBrand(hashData,stdReportId,formHandlerFor==0?true:useLiveForFirst);
putMultiLangDescriptions(hashData,stdReportId);
index++;
if (stdReportIds!=null && stdReportIds[0].equals(stdReportIds[1])){
continueRunning=false;
}
if (formHandlerFor==REPORTS){
putBeginDate(hashData,effDate,custId);
}
//handle logic that is related to pricemaps.
lstOfData.add(hashData);
}
}
What design pattern should I apply to this problem?