CentralWavelengthProvider { public void readCW(InputStream inputStream) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); for (int i = 0; i < centralWavelenthRr.length; i++) { String line = bufferedReader.readLine(); line = line.trim(); centralWavelenthRr[i] = Float.parseFloat(line); } } CentralWavelengthProvider(); void readAuxData(File auxDataDir); void readCW(InputStream inputStream); float[] getCentralWavelength(final String productType);  }
@Test public void testReadCW() throws IOException { final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); for (int i = 0; i < 925; i++) { final String line = String.valueOf(i) + "\n"; outputStream.write(line.getBytes()); } final byte[] outArray = outputStream.toByteArray(); final InputStream inputStream = new ByteArrayInputStream(outArray); provider.readCW(inputStream); final float[] cwRR = provider.getCentralWavelength("MER_RR"); assertEquals("925 members", 925, cwRR.length); assertEquals("value 0", 0f, cwRR[0], DIFF); assertEquals("value 1", 1f, cwRR[1], DIFF); assertEquals("value 2", 2f, cwRR[2], DIFF); assertEquals("value 924", 924f, cwRR[924], DIFF); }