package model;

import org.junit.Test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Scanner;

import static org.junit.Assert.*;

/**
 * Created by Elliad on 2016-05-08.
 */
public class FileModelTest {
    @Test
    public void fileReadTest() {
        ArrayList<String> testArraylist = new ArrayList<String>();
        testArraylist.add("asdf\n");
        testArraylist.add("asdf");
        assertTrue(FileModel.getModel().readFile("A.txt"));
        assertEquals(FileModel.getModel().getStringArrayList(),testArraylist);


    }

    @Test
    public void fileWriteTest() {
        assertTrue(FileModel.getModel().writeFile("AA.txt"));
        ArrayList<String> testArraylist = new ArrayList<String>();
        try(Scanner in = new Scanner(new FileReader("AA.txt")))
        {
            String tempString = "";
            while(in.hasNext()) {
                tempString = in.next(); //임시 텍스트에 개행을 제외한 한 줄을 불러온다
                if(in.hasNext()) tempString +="\n"; //다음 줄이 없을 때는 개행을 추가하지 않는다.
                testArraylist.add(tempString);
            }
        } catch (FileNotFoundException e) {

            e.printStackTrace();
        }
        assertEquals(FileModel.getModel().getStringArrayList(),testArraylist);

    }
}

@@ -317,32 +317,83 @@
 ileReadTest() %7B%0A
+        FileModel testFileModel = new FileModel();%0A
         ArrayLis
@@ -526,32 +526,36 @@
      assertTrue(
+test
 FileModel.getMod
@@ -548,27 +548,16 @@
 leModel.
-getModel().
 readFile
@@ -581,32 +581,36 @@
    assertEquals(
+test
 FileModel.getMod
@@ -599,35 +599,24 @@
 stFileModel.
-getModel().
 getStringArr
@@ -705,39 +705,83 @@
     
-assertTrue(FileModel.getModel()
+FileModel testFileModel = new FileModel();%0A        assertTrue(testFileModel
 .wri
@@ -1328,16 +1328,20 @@
 tEquals(
+test
 FileMode
@@ -1349,19 +1349,8 @@
 .get
-Model().get
 Stri
@@ -1380,16 +1380,553 @@
 list
+);%0A%0A    %7D%0A    @Test%0A    public void getStatusTest()%0A    %7B%0A        FileModel testFileModel = new FileModel();%0A        String testStatus = %22Ready(No file is loaded)%22;%0A        assertEquals(testFileModel.getStatus(),testStatus);%0A        assertTrue(testFileModel.readFile(%22A.txt%22));%0A        testStatus = %22File Loaded Successfully%22;%0A        assertEquals(testFileModel.getStatus(),testStatus);%0A        testFileModel.writeFile(%22AA.txt%22);%0A        testStatus = %22File Written successfully%22;%0A        assertEquals(testFileModel.getStatus(),testStatus
 );%0A
-%0A
     %7D%0A
+%0A
 %7D%0A

Add getStatus Test