<commit_before>package fr.insee.pogues.transforms;

import org.junit.Assert;
import org.junit.Test;
import org.xmlunit.XMLUnitException;
import org.xmlunit.diff.Diff;

import java.io.IOException;

/**
 * Created by acordier on 19/07/17.
 */
public class TestPoguesTransform {

    @Test
    public void popoQpoCam2017TransformTest() {
        performDiffTest("transforms/POPO-QPO-CAM2017");
    }

    @Test
    public void popoQpoCammeTransformTest() {
        performDiffTest("transforms/POPO-QPO-CAMME");
    }

    @Test
    public void popoQpoCis2016TransformTest(){
        performDiffTest("transforms/POPO-QPO-CIS2016Q_E");
    }

    @Test
    public void popoQpoCis2017TransformTest() {
        performDiffTest("transforms/POPO-QPO-CIS2017Q_E");
    }

    @Test // TODO Activer à l'intégration de la liaison RMES
    public void popoDechetsComm() {
        System.out.println("Test skipped");
//        performDiffTest("transforms/POPO-QPO-DECHETS_COMM");
    }

    @Test // TODO Activer à l'intégration de la liaison RMES
    public void popoDechets2016() {
        System.out.println("Test skipped");
//        performDiffTest("transforms/POPO-QPO-DECHETS2016");
    }

    @Test
    public void popoQpoDoc() {
        performDiffTest("transforms/POPO-QPO-DOC");
    }


    @Test
    public void popoQpoDocEnTransformTest() {
        performDiffTest("transforms/POPO-QPO-DOC-EN");
    }

    @Test // TODO Activer à l'intégration de la liaison RMES
    public void popoQpoFiltreSeq() {
        System.out.println("Test skipped");
//        performDiffTest("POPO-QPO-FILTRE_SEQ");
    }


    private void performDiffTest(String path) {
        try {
            Diff diff = XmlDiff.getDiff(path);
            Assert.assertFalse(getDiffMessage(diff, path), diff.hasDifferences());
        } catch (XMLUnitException e) {
            e.printStackTrace();
            Assert.fail();
        } catch (IOException e){
            e.printStackTrace();
            Assert.fail();
        } catch (NullPointerException e){
            e.printStackTrace();
            Assert.fail();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }

    private String getDiffMessage(Diff diff, String path) {
        return String.format("Transformed ouput for %s should match expected DDI document: %s", path, diff.toString());
    }


}<commit_msg>Fix typo in failure message<commit_after>package fr.insee.pogues.transforms;

import org.junit.Assert;
import org.junit.Test;
import org.xmlunit.XMLUnitException;
import org.xmlunit.diff.Diff;

import java.io.IOException;

/**
 * Created by acordier on 19/07/17.
 */
public class TestPoguesTransform {

    @Test
    public void popoQpoCam2017TransformTest() {
        performDiffTest("transforms/POPO-QPO-CAM2017");
    }

    @Test
    public void popoQpoCammeTransformTest() {
        performDiffTest("transforms/POPO-QPO-CAMME");
    }

    @Test
    public void popoQpoCis2016TransformTest(){
        performDiffTest("transforms/POPO-QPO-CIS2016Q_E");
    }

    @Test
    public void popoQpoCis2017TransformTest() {
        performDiffTest("transforms/POPO-QPO-CIS2017Q_E");
    }

    @Test // TODO Activer à l'intégration de la liaison RMES
    public void popoDechetsComm() {
        System.out.println("Test skipped");
//        performDiffTest("transforms/POPO-QPO-DECHETS_COMM");
    }

    @Test // TODO Activer à l'intégration de la liaison RMES
    public void popoDechets2016() {
        System.out.println("Test skipped");
//        performDiffTest("transforms/POPO-QPO-DECHETS2016");
    }

    @Test
    public void popoQpoDoc() {
        performDiffTest("transforms/POPO-QPO-DOC");
    }


    @Test
    public void popoQpoDocEnTransformTest() {
        performDiffTest("transforms/POPO-QPO-DOC-EN");
    }

    @Test // TODO Activer à l'intégration de la liaison RMES
    public void popoQpoFiltreSeq() {
        System.out.println("Test skipped");
//        performDiffTest("POPO-QPO-FILTRE_SEQ");
    }


    private void performDiffTest(String path) {
        try {
            Diff diff = XmlDiff.getDiff(path);
            Assert.assertFalse(getDiffMessage(diff, path), diff.hasDifferences());
        } catch (XMLUnitException e) {
            e.printStackTrace();
            Assert.fail();
        } catch (IOException e){
            e.printStackTrace();
            Assert.fail();
        } catch (NullPointerException e){
            e.printStackTrace();
            Assert.fail();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }

    private String getDiffMessage(Diff diff, String path) {
        return String.format("Transformed output for %s should match expected DDI document:\n %s", path, diff.toString());
    }


}
{'fraction_non_alphanumeric': 0.11547295886406347, 'fraction_numerical': 0.015869701399039465, 'mean_word_length': 2.596096096096096, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '6345989', 'n_tokens_mistral': 1606, 'n_tokens_neox': 1495, 'n_words': 292}