public String listReaderOptions(IChemFormat format) { if (format.getReaderClassName() == null) return "No reader avaiable for this format"; IChemObjectReader reader = readerFactory.createReader(format); if (reader == null) return "Cannot instantiate writer: " + format.getReaderClassName(); IOSetting[] settings = reader.getIOSettings(); if (settings == null || settings.length == 0) return "The reader does not have options"; StringBuffer overview = new StringBuffer(); for (String _ : new String[] { format.getFormatName(), JsConsoleView.NEWLINE }) overview.append(_); for (IOSetting setting : settings) { for (String _ : new String[] { "[", setting.getName(), "]", JsConsoleView.NEWLINE, setting.getQuestion(), JsConsoleView.NEWLINE, "Default value: ", setting.getDefaultSetting(), JsConsoleView.NEWLINE, "Value : ", setting.getSetting(), JsConsoleView.NEWLINE}) overview.append(_); } return overview.toString(); }
@Test public void testGetIOSetting() { IOSetting[] settings = chemObjectIO.getIOSettings(); for (IOSetting setting : settings) { Assert.assertNotNull(setting); Assert.assertNotNull(setting.getDefaultSetting()); Assert.assertNotNull(setting.getName()); Assert.assertNotNull(setting.getQuestion()); Assert.assertNotNull(setting.getLevel()); } }