CentralWavelengthProvider { public float[] getCentralWavelength(final String productType) { if (productType.startsWith("MER_RR")) { return centralWavelenthRr; } else if (productType.startsWith("MER_F")) { return generateCentralWavelengthFr(); } else { throw new IllegalArgumentException("'The product has an unsupported product type: " + productType); } } CentralWavelengthProvider(); void readAuxData(File auxDataDir); void readCW(InputStream inputStream); float[] getCentralWavelength(final String productType);  }
@Test(expected = IllegalArgumentException.class) public void testIllegalProductType() { provider.getCentralWavelength("MER_TT"); }
@Test public void testInit() { final float[] cwRR = provider.getCentralWavelength("MER_RR"); assertEquals("925 members", 925, cwRR.length); assertEquals("value 0", 0f, cwRR[0], DIFF); assertEquals("value 1", 0f, cwRR[1], DIFF); assertEquals("value 924", 0f, cwRR[924], DIFF); }
@Test public void testIllegalProductType() { try { provider.getCentralWavelength("MER_TT"); fail("Exception expected."); } catch (IllegalArgumentException ignored) { } }