@Test public void testLoadCodeThrowsFileNotFoundException() throws Throwable { BSHLogListener bSHLogListener = new BSHLogListener(); File f = new File("testBSHLogListenerParam1"); try { bSHLogListener.loadCode(f); fail("Expected FileNotFoundException to be thrown"); } catch (FileNotFoundException ex) { assertEquals(FileNotFoundException.class, ex.getClass(), "ex.getClass()"); assertEquals("testBSHLogListenerParam1", f.getName(), "f.getName()"); } }
protected String loadCode(File f) throws IOException{ StringBuilder buf = new StringBuilder((int)f.length()); char[] content = new char[(int)f.length()]; int l; Reader r = new BufferedReader(new FileReader(f)); try { while((l=r.read(content))!=-1) buf.append(content,0,l); } finally { r.close(); } return buf.toString(); }
BSHLogListener implements org.jpos.util.LogListener, org.jpos.core.Configurable { protected String loadCode(File f) throws IOException{ StringBuilder buf = new StringBuilder((int)f.length()); char[] content = new char[(int)f.length()]; int l; Reader r = new BufferedReader(new FileReader(f)); try { while((l=r.read(content))!=-1) buf.append(content,0,l); } finally { r.close(); } return buf.toString(); } }
BSHLogListener implements org.jpos.util.LogListener, org.jpos.core.Configurable { protected String loadCode(File f) throws IOException{ StringBuilder buf = new StringBuilder((int)f.length()); char[] content = new char[(int)f.length()]; int l; Reader r = new BufferedReader(new FileReader(f)); try { while((l=r.read(content))!=-1) buf.append(content,0,l); } finally { r.close(); } return buf.toString(); } BSHLogListener(); }
BSHLogListener implements org.jpos.util.LogListener, org.jpos.core.Configurable { protected String loadCode(File f) throws IOException{ StringBuilder buf = new StringBuilder((int)f.length()); char[] content = new char[(int)f.length()]; int l; Reader r = new BufferedReader(new FileReader(f)); try { while((l=r.read(content))!=-1) buf.append(content,0,l); } finally { r.close(); } return buf.toString(); } BSHLogListener(); @Override void setConfiguration(org.jpos.core.Configuration cfg); @Override LogEvent log(LogEvent ev); }
BSHLogListener implements org.jpos.util.LogListener, org.jpos.core.Configurable { protected String loadCode(File f) throws IOException{ StringBuilder buf = new StringBuilder((int)f.length()); char[] content = new char[(int)f.length()]; int l; Reader r = new BufferedReader(new FileReader(f)); try { while((l=r.read(content))!=-1) buf.append(content,0,l); } finally { r.close(); } return buf.toString(); } BSHLogListener(); @Override void setConfiguration(org.jpos.core.Configuration cfg); @Override LogEvent log(LogEvent ev);  }