package ru.matevosyan;

import org.junit.Test;

import java.io.File;
import java.io.IOException;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;

/**
 * Created SortFile for testing sort big file and write it to a new file.
 * Created on 19.02.2017.
 * @since 1.0
 * @author Matevosyan Vardan
 * @version 1.0
 */
public class SortFileTest {
    @Test
    public void whenAddFileThanSortToAnotherFile() {
        String pathSource = "C:\\Users\\Admin\\Desktop\\Abbat.txt";
        String pathDist = "C:\\Users\\Admin\\Desktop\\AbbatResults.txt";

        File sourceFile = new File(pathSource);
        File distFile = new File(pathDist);

        SortFile sortFile = new SortFile();

        try {
            sortFile.sort(sourceFile, distFile);
        } catch (IOException ioe) {
            System.out.println(ioe.getMessage());
        }

        long l = sourceFile.length();

        assertThat(distFile.length(), is(l));
    }


}
@@ -13,24 +13,54 @@
 atevosyan;%0A%0A
+import org.junit.BeforeClass;%0A
 import org.j
@@ -191,17 +191,26 @@
 .Assert.
-*
+assertThat
 ;%0A%0A/**%0A 
@@ -371,16 +371,17 @@
 1.0%0A */%0A
+%0A
 public c
@@ -404,85 +404,462 @@
 t %7B%0A
+%0A
     
-@Test%0A    public void whenAddFileThanSortToAnotherFile() %7B%0A        String
+private static String pathSource;%0A    private static String pathDist;%0A    private static File sourceFile;%0A    private static File distFile;%0A    private static SortFile sortFile;%0A%0A    /**%0A     * execute all common variable before start testing class methods, that use anywhere in the class.%0A     * @throws IOException when path to a file is invalid.%0A     */%0A%0A    @BeforeClass%0A    public static void executeSameVariable() throws IOException %7B%0A%0A       
  pat
@@ -916,23 +916,16 @@
         
-String 
 pathDist
@@ -983,21 +983,16 @@
         
-File 
 sourceFi
@@ -1026,21 +1026,16 @@
         
-File 
 distFile
@@ -1057,25 +1057,24 @@
 hDist);%0A
-%0A
         
 SortFile
@@ -1065,25 +1065,25 @@
         
-S
+s
 ortFile 
 sortFile
@@ -1074,25 +1074,16 @@
 ortFile 
-sortFile 
 = new So
@@ -1091,16 +1091,146 @@
 tFile();
+%0A    %7D%0A%0A    /**%0A     * testing files size.%0A     */%0A%0A    @Test%0A    public void whenAddFileAndSortToAnotherFileThanCheckFileSize() %7B
 %0A%0A      
@@ -1475,10 +1475,1098 @@
 %0A    %7D%0A%0A
+    /**%0A     * testing %7B@link SortFile#sort(File, File)%7D that sorting the file.%0A     */%0A%0A    @Test%0A    public void whenAddFileAndSortToAnotherFileThanCheckIfItSort() %7B%0A%0A        try %7B%0A%0A            File sourceFile = new File(pathSource);%0A            File distFile = new File(pathDist);%0A            sortFile.sort(sourceFile, distFile);%0A%0A        %7D catch (IOException ioe) %7B%0A            System.out.println(ioe.getMessage());%0A        %7D%0A%0A        String%5B%5D expectedArray = %7B%0A                %221%22,%0A                %2222%22,%0A                %2222%22,%0A                %22333%22,%0A                %224444%22,%0A                %220000%22,%0A                %2255555%22,%0A                %2255555%22,%0A                %22666666%22,%0A                %22666666%22,%0A                %22666666%22,%0A                %22666666%22,%0A                %228888888%22,%0A                %2277777777%22,%0A                %22999999999%22,%0A                %22999999999%22%0A        %7D;%0A%0A       String%5B%5D sActualArray = sortFile.getStringsThirdSortedToRead();%0A%0A        for (int i = 0; i %3C expectedArray.length; i++) %7B%0A            assertThat(expectedArray%5Bi%5D, is(sActualArray%5Bi%5D));%0A        %7D%0A    %7D%0A
 %0A%7D

add javadoc