SstCoefficientLoader { public String getDescription(URL coeffFile) throws IOException { Guardian.assertNotNull("coeffFile", coeffFile); String desc = ""; File file = null; try { file = new File(coeffFile.toURI()); } catch (URISyntaxException e) { } if (file != null && file.exists() && file.isFile()) { InputStream inStream = new FileInputStream(file); _props.load(inStream); inStream.close(); desc = _props.getProperty(_descriptionKey); } return desc; } SstCoefficientLoader(); SstCoefficientSet load(URL coeffFile); String getDescription(URL coeffFile);  }
@Test public void testLoadDescriptionInterface() throws IOException { try { loader.getDescription(null); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException ignored) { } URL nonExistent = createNonExistentUrl(); String description = loader.getDescription(nonExistent); assertEquals("", description); }
@Test public void testLoadDescription() throws IOException, URISyntaxException { String description; URL url; url = createDualCoeffUrl(); description = loader.getDescription(url); assertEquals(expDualDesc, description); url = createNadirCoeffUrl(); description = loader.getDescription(url); assertEquals(expNadirDesc, description); }