SstCoefficientLoader { public SstCoefficientSet load(URL coeffFile) throws IOException { Guardian.assertNotNull("coeffFile", coeffFile); _logger.fine("Reading coefficient file: '" + coeffFile.getPath() + "'"); InputStream inStream = coeffFile.openStream(); _props.clear(); try { _props.load(inStream); } finally { inStream.close(); } SstCoefficientSet set = new SstCoefficientSet(); addDescription(set); addCoefficients(set); verify(set); _logger.fine("... success"); return set; } SstCoefficientLoader(); SstCoefficientSet load(URL coeffFile); String getDescription(URL coeffFile);  }
@Test public void testLoadWithInvalidArguments() throws IOException { try { loader.load(null); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { } URL noneExistent = createNonExistentUrl(); try { loader.load(noneExistent); fail("IOException expected"); } catch (IOException e) { } }
@Test public void testLoadCorrectFile() throws IOException, URISyntaxException { URL nadirCoeff = createNadirCoeffUrl(); URL dualCoeff = createDualCoeffUrl(); SstCoefficientSet coeffs; coeffs = loader.load(nadirCoeff); assertNotNull(coeffs); coeffs = loader.load(dualCoeff); assertNotNull(coeffs); }
@Test public void testIncorrectNumberOfMaps() throws IOException, URISyntaxException { URL illegalFile = createOneMapTooMuchUrl(); try { loader.load(illegalFile); fail("OperatorException expected"); } catch (OperatorException ignored) { } illegalFile = createMapOverlapUrl(); try { loader.load(illegalFile); fail("OperatorException expected"); } catch (OperatorException ignored) { } illegalFile = create_A_and_D_Url(); try { loader.load(illegalFile); fail("OperatorException expected"); } catch (OperatorException ignored) { } }