ProductInventoryEntry { public static ProductInventoryEntry create(String startTime, String stopTime, String length, String processStartLine, String processLength, String message) throws ParseException { ProductData.UTC startTimeUTC = ProductData.UTC.parse(startTime, DATE_PATTERN); ProductData.UTC stopTimeUTC = ProductData.UTC.parse(stopTime, DATE_PATTERN); int lengthInt = Integer.parseInt(length); int processStartLineInt = Integer.parseInt(processStartLine); int processLengthInt = Integer.parseInt(processLength); return new ProductInventoryEntry(startTimeUTC, stopTimeUTC, lengthInt, processStartLineInt, processLengthInt, message); } private  ProductInventoryEntry(ProductData.UTC startTime, ProductData.UTC stopTime, int length, int processStartLine, int processLength, String message); static ProductInventoryEntry create(String startTime, String stopTime, String length, String processStartLine, String processLength, String message); static ProductInventoryEntry createEmpty(String message); static ProductInventoryEntry createForGoodProduct(Product product, String message); static ProductInventoryEntry createForBadProduct(Product product, String message); ProductData.UTC getStartTime(); ProductData.UTC getStopTime(); int getLength(); void setProcessStartLine(int processStartLine); int getProcessStartLine(); void setProcessLength(int processLength); int getProcessLength(); String getMessage(); String getProductName(); void setProductName(String productName); String toCSVString(); static final int NUM_ENTRIES; static final String DATE_PATTERN; }
@Test public void testCreate() throws Exception { ProductInventoryEntry entry = ProductInventoryEntry.create("2001-10-02-13-10-11.123400", "2001-12-02-13-12-14.456789", "65", "3", "44", "bar"); assertNotNull(entry); assertEquals("bar", entry.getMessage()); assertEquals(65, entry.getLength()); assertEquals(3, entry.getProcessStartLine()); assertEquals(44, entry.getProcessLength()); assertNotNull(entry.getStartTime()); assertTrue(ProductData.UTC.parse("02-Oct-2001 13:10:11.1234").equalElems(entry.getStartTime())); assertNotNull(entry.getStopTime()); assertTrue(ProductData.UTC.parse("02-Dec-2001 13:12:14.456789").equalElems(entry.getStopTime())); }