SPQRWebSocketServer { protected void run(final String configurationFile) throws IOException, InterruptedException { File cfgFile = new File(StringUtils.trim(configurationFile)); if(!cfgFile.isFile()) throw new FileNotFoundException("No configuration file found at '"+configurationFile+"'"); run(new FileInputStream(cfgFile)); }  static Options getOptions(); static void main(String[] args); static final String CFG_HELP; static final String CFG_HELP_SHORT; static final String CFG_CONFIGURATION_FILE; static final String CFG_CONFIGURATION_FILE_SHORT; }
@Test public void testRun_withEmptyFileReference() throws Exception { try { new SPQRWebSocketServer().run(""); Assert.fail("Invalid input"); } catch(IOException e) { } }
@Test public void testRun_withInvalidFileReference() throws Exception { try { new SPQRWebSocketServer().run("/no/such/folder/no-such-file-"+System.currentTimeMillis()+"-.cfg"); Assert.fail("Invalid input"); } catch(IOException e) { } }
@Test public void testRun_withStreamHoldingNonJSONString() throws Exception { try { new SPQRWebSocketServer().run(new ByteArrayInputStream("no-json".getBytes())); Assert.fail("Invalid input"); } catch(JsonParseException e) { } }
@Test public void testRun_withStreamHoldingInvalidJSONFormat() throws Exception { try { new SPQRWebSocketServer().run(new ByteArrayInputStream("{\"field\":\"value\"}".getBytes())); Assert.fail("Invalid input"); } catch(UnrecognizedPropertyException e) { } }