<commit_before>package innovimax.mixthem.test001;

import innovimax.mixthem.MixThem;
import innovimax.mixthem.Constants;
import innovimax.mixthem.MixException;

import java.io.*;

import org.junit.Assert;
import org.junit.Test;

/*
    Created by innovimax
    Generic tests for this application
*/
public class GenericTest {

   @Test
   public final void check1() throws MixException {
          ClassLoader classLoader = getClass().getClassLoader();
          File file1 = new File(classLoader.getResource("file1.txt").getFile());
          File file2 = new File(classLoader.getResource("file2.txt").getFile());
          ByteArrayOutputStream baos_rule_1 = new ByteArrayOutputStream();
          MixThem.processFiles(Constants.RULE_1, file1, file2, baos_rule_1);
          Assert.assertTrue(checkFileEquals(file1, baos_rule_1.toByteArray()));
          ByteArrayOutputStream baos_rule_2 = new ByteArrayOutputStream();
          MixThem.processFiles(Constants.RULE_2, file1, file2, baos_rule_2);
          Assert.assertTrue(checkFileEquals(file2, baos_rule_2.toByteArray()));
    }
	
    private static boolean checkFileEquals(File fileExpected, byte[] result) {
       FileInputStream fisExpected = new FileInputStream(fileExpected);
       int c;
       int offset = 0;
       while ((c = fisExpected.read()) != -1) {
	   if (offset >= result.length) return false;
          int d = result[offset++];
          if (c != d) return false;
       }
	   if (offset >= result.length) return false;
          int e = result[offset++];
       if (c != e) return false;
       return true;
    }

}
<commit_msg>add FileNotFoundException, IOException<commit_after>package innovimax.mixthem.test001;

import innovimax.mixthem.MixThem;
import innovimax.mixthem.Constants;
import innovimax.mixthem.MixException;

import java.io.*;

import org.junit.Assert;
import org.junit.Test;

/*
    Created by innovimax
    Generic tests for this application
*/
public class GenericTest {

   @Test
   public final void check1() throws MixException, FileNotFoundException, IOException {
          ClassLoader classLoader = getClass().getClassLoader();
          File file1 = new File(classLoader.getResource("file1.txt").getFile());
          File file2 = new File(classLoader.getResource("file2.txt").getFile());
          ByteArrayOutputStream baos_rule_1 = new ByteArrayOutputStream();
          MixThem.processFiles(Constants.RULE_1, file1, file2, baos_rule_1);
          Assert.assertTrue(checkFileEquals(file1, baos_rule_1.toByteArray()));
          ByteArrayOutputStream baos_rule_2 = new ByteArrayOutputStream();
          MixThem.processFiles(Constants.RULE_2, file1, file2, baos_rule_2);
          Assert.assertTrue(checkFileEquals(file2, baos_rule_2.toByteArray()));
    }
	
    private static boolean checkFileEquals(File fileExpected, byte[] result) throws FileNotFoundException, IOException {
       FileInputStream fisExpected = new FileInputStream(fileExpected);
       int c;
       int offset = 0;
       while ((c = fisExpected.read()) != -1) {
	   if (offset >= result.length) return false;
          int d = result[offset++];
          if (c != d) return false;
       }
	   if (offset >= result.length) return false;
          int e = result[offset++];
       if (c != e) return false;
       return true;
    }

}

{'fraction_non_alphanumeric': 0.10665863211810786, 'fraction_numerical': 0.014462187405845135, 'mean_word_length': 3.300518134715026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1084158', 'n_tokens_mistral': 974, 'n_tokens_neox': 963, 'n_words': 229}