CsvProductReader extends AbstractProductReader { void getProductData(Object[] elems, ProductData destBuffer) { switch (destBuffer.getType()) { case ProductData.TYPE_FLOAT32: { for (int i = 0; i < destBuffer.getNumElems(); i++) { final Object elem; if (i < elems.length) { elem = elems[i] != null ? elems[i] : Float.NaN; } else { elem = Float.NaN; } destBuffer.setElemFloatAt(i, (Float) elem); } break; } case ProductData.TYPE_FLOAT64: { for (int i = 0; i < destBuffer.getNumElems(); i++) { final Object elem; if (i < elems.length) { elem = elems[i] != null ? elems[i] : Double.NaN; } else { elem = Double.NaN; } destBuffer.setElemDoubleAt(i, (Double) elem); } break; } case ProductData.TYPE_INT8: { for (int i = 0; i < elems.length; i++) { final Object elem = elems[i] != null ? elems[i] : 0; destBuffer.setElemIntAt(i, (Byte) elem); } break; } case ProductData.TYPE_INT16: { for (int i = 0; i < elems.length; i++) { final Object elem = elems[i] != null ? elems[i] : 0; destBuffer.setElemIntAt(i, (Short) elem); } break; } case ProductData.TYPE_INT32: { for (int i = 0; i < elems.length; i++) { final Object elem = elems[i] != null ? elems[i] : 0; destBuffer.setElemIntAt(i, (Integer) elem); } break; } default: { throw new IllegalArgumentException( "Unsupported type '" + ProductData.getTypeString(destBuffer.getType()) + "'."); } } } protected  CsvProductReader(ProductReaderPlugIn readerPlugIn); @Override void close();  }
@Test public void testInvalidInput() throws Exception { try { ((CsvProductReader)reader).getProductData(null, new ProductData.UTC()); fail(); } catch (IllegalArgumentException expected) { assertTrue(expected.getMessage().matches("Unsupported type.*")); } }