private void readProductPlanning(TestableMRP mrpTest, String[] header, List<String> line) {
   mrpTest.name = "junit-test-line_" + reader.getLineNumber();
   mrpTest.description = "Test starts in CSV at line " + reader.getLineNumber();
   mrpTest.qtyOnHand = getValue("QtyOnHand", BigDecimal.class, header, line);
   mrpTest.today = getValue("Today", Timestamp.class, header, line);
   //
   int LeadTime = getValue("LeadTime", Integer.class, header, line);
   int TimeFence = getValue("TimeFence", Integer.class, header, line);
   String Order_Policy = getValue("Order_Policy", String.class, header, line);
   int Order_Min = getValue("Order_Min", Integer.class, header, line);
   int Order_Pack = getValue("Order_Pack", Integer.class, header, line);
   int Order_Max = getValue("Order_Max", Integer.class, header, line);
   int Order_Period = getValue("Order_Period", Integer.class, header, line);
   int SafetyStock = getValue("SafetyStock", Integer.class, header, line);
   int Yield = getValue("Yield", Integer.class, header, line);
   //
   mrpTest.planning =
       MRPUtil.getPlanning(
           mrpTest.productValue,
           Order_Policy,
           Order_Min,
           Order_Max,
           Order_Pack,
           SafetyStock,
           Order_Period,
           LeadTime);
   mrpTest.planning.setTimeFence(BigDecimal.valueOf(TimeFence));
   mrpTest.planning.setYield(Yield);
 }
 private void readMRPLine(TestableMRP mrpTest, String[] header, List<String> line) {
   boolean isGenerated = getValue("Generated", Boolean.class, header, line);
   Timestamp DatePromised = getValue("DatePromised", Timestamp.class, header, line);
   Timestamp DateStartSchedule = getValue("DateStartSchedule", Timestamp.class, header, line);
   String TypeMRP = getValue("TypeMRP", String.class, header, line);
   String DocStatus = getValue("DocStatus", String.class, header, line);
   BigDecimal Qty = getValue("Qty", BigDecimal.class, header, line);
   String MRP_Notice = getValue("MRP_Notice", String.class, header, line);
   //
   if (MRP_Notice != null
       && MRP_Notice.trim().length() > 0
       && TestableMRP.isTestableMRPNotice(MRP_Notice)) {
     mrpTest.expectedNotices.add(new MRPNotice(MRP_Notice));
   }
   //
   if (TypeMRP == null || TypeMRP.trim().length() == 0) {;
   } else {
     I_PP_MRP mrp =
         MRPUtil.createMRP(
             mrpTest.planning, TypeMRP, DocStatus, Qty, DatePromised, DateStartSchedule);
     mrp.setDescription("CSV Line " + reader.getLineNumber());
     if (isGenerated) {
       mrpTest.expectedMRP.add(mrp);
     } else {
       mrpTest.initialMRP.add(mrp);
     }
   }
 }
 public Collection<TestableMRP> read(InputStream in) throws Exception {
   ArrayList<TestableMRP> tests = new ArrayList<TestableMRP>();
   //
   reader = new CsvListReader(new InputStreamReader(in), CsvPreference.STANDARD_PREFERENCE);
   String[] header = reader.getCSVHeader(true);
   System.out.println("HEADER: " + MRPUtil.toString(header));
   //
   List<String> line;
   int last_lineNo = -1;
   boolean isPlanningLine = true;
   TestableMRP mrpTest = null;
   try {
     while ((line = reader.read()) != null) {
       if (last_lineNo == -1 || last_lineNo + 1 < reader.getLineNumber()) {
         isPlanningLine = true;
         if (mrpTest != null) {
           tests.add(mrpTest);
         }
         mrpTest = new TestableMRP();
       }
       if (isPlanningLine) {
         readProductPlanning(mrpTest, header, line);
         isPlanningLine = false;
       } else {
         readMRPLine(mrpTest, header, line);
       }
       //
       last_lineNo = reader.getLineNumber();
     }
   } catch (Exception e) {
     throw new RuntimeException(
         "Error on line " + reader.getLineNumber() + ": " + e.getLocalizedMessage(), e);
   }
   if (mrpTest != null) {
     tests.add(mrpTest);
   }
   //
   return tests;
 }