@Test public void test_filenotfoundsotextareawontchange(){ testtxt.setText("abcdefg"); testtxt.setText("123"); filename="gibtesgarnicht"; LoadnSave.load(filename,testtxt,false); assertEquals("123",testtxt.getText()); }
public static void load(String FileName,TextArea txtarea,boolean isTest){ File file; if(isTest) file = new File("TestsNClasses/"+FileName+"Test.java"); else file = new File("TestsNClasses/"+FileName+".java"); BufferedReader in = null; try { in = new BufferedReader(new FileReader(file)); ArrayList<String> input=new ArrayList<String>(); String inp=in.readLine(); while(inp!=null) { input.add(inp+'\n'); inp = in.readLine(); } txtarea.clear(); for(String s:input) { txtarea.appendText(s); } } catch (Exception e) { System.out.print(e); } }
LoadnSave { public static void load(String FileName,TextArea txtarea,boolean isTest){ File file; if(isTest) file = new File("TestsNClasses/"+FileName+"Test.java"); else file = new File("TestsNClasses/"+FileName+".java"); BufferedReader in = null; try { in = new BufferedReader(new FileReader(file)); ArrayList<String> input=new ArrayList<String>(); String inp=in.readLine(); while(inp!=null) { input.add(inp+'\n'); inp = in.readLine(); } txtarea.clear(); for(String s:input) { txtarea.appendText(s); } } catch (Exception e) { System.out.print(e); } } }
LoadnSave { public static void load(String FileName,TextArea txtarea,boolean isTest){ File file; if(isTest) file = new File("TestsNClasses/"+FileName+"Test.java"); else file = new File("TestsNClasses/"+FileName+".java"); BufferedReader in = null; try { in = new BufferedReader(new FileReader(file)); ArrayList<String> input=new ArrayList<String>(); String inp=in.readLine(); while(inp!=null) { input.add(inp+'\n'); inp = in.readLine(); } txtarea.clear(); for(String s:input) { txtarea.appendText(s); } } catch (Exception e) { System.out.print(e); } }  }
LoadnSave { public static void load(String FileName,TextArea txtarea,boolean isTest){ File file; if(isTest) file = new File("TestsNClasses/"+FileName+"Test.java"); else file = new File("TestsNClasses/"+FileName+".java"); BufferedReader in = null; try { in = new BufferedReader(new FileReader(file)); ArrayList<String> input=new ArrayList<String>(); String inp=in.readLine(); while(inp!=null) { input.add(inp+'\n'); inp = in.readLine(); } txtarea.clear(); for(String s:input) { txtarea.appendText(s); } } catch (Exception e) { System.out.print(e); } }  static void load(String FileName,TextArea txtarea,boolean isTest); static void save(String FileName,String text,boolean isTest); }
LoadnSave { public static void load(String FileName,TextArea txtarea,boolean isTest){ File file; if(isTest) file = new File("TestsNClasses/"+FileName+"Test.java"); else file = new File("TestsNClasses/"+FileName+".java"); BufferedReader in = null; try { in = new BufferedReader(new FileReader(file)); ArrayList<String> input=new ArrayList<String>(); String inp=in.readLine(); while(inp!=null) { input.add(inp+'\n'); inp = in.readLine(); } txtarea.clear(); for(String s:input) { txtarea.appendText(s); } } catch (Exception e) { System.out.print(e); } }  static void load(String FileName,TextArea txtarea,boolean isTest); static void save(String FileName,String text,boolean isTest);  }