package be.iminds.ilabt.jfed.rspec.parser;

import be.iminds.ilabt.jfed.rspec.model.StringRspec;
import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * TestSimilarXml
 */
public class TestSimilarXml {
    @Test
    public void testIsSimilarXml1() {
        Assert.assertTrue(StringRspec.isSimilarXml(TestRspecsLibrary.testSamerspeclinkA, TestRspecsLibrary.testSamerspecAsameA));  //different order, missing generated and added generated_by
    }

    @Test
    public void testIsSimilarXml2() {
        Assert.assertTrue(StringRspec.isSimilarXml(TestRspecsLibrary.testSamerspeclinkA, TestRspecsLibrary.testSamerspecAsameB));  //has extra data in jfed namespace (which should be ignored)
    }

    @Test
    public void testIsSimilarXml3() {
        Assert.assertFalse(StringRspec.isSimilarXml(TestRspecsLibrary.testSamerspeclinkA, TestRspecsLibrary.testSamerspecAdiffA)); //extra attribute in first node
    }

    @Test
    public void testIsSimilarXml4() {
        Assert.assertFalse(StringRspec.isSimilarXml(TestRspecsLibrary.testSamerspeclinkA, TestRspecsLibrary.testSamerspecAdiffB)); //extra attribute in rspec
    }

    @Test
    public void testIsSimilarXml5() {
        Assert.assertFalse(StringRspec.isSimilarXml(TestRspecsLibrary.testSamerspeclinkA, TestRspecsLibrary.testSamerspecAdiffC)); //missing attribute type in rspec
    }

    @Test
    public void testIsSimilarXml6() {
        Assert.assertFalse(StringRspec.isSimilarXml(TestRspecsLibrary.testSamerspeclinkA, TestRspecsLibrary.testSamerspecAdiffD)); //missing sliver_type in 2nd node
    }

    @Test
    public void testIsSimilarXml7() {
        Assert.assertFalse(StringRspec.isSimilarXml(TestRspecsLibrary.testSamerspeclinkA, TestRspecsLibrary.testSamerspecAdiffE)); //type manifest instead of request
    }

    @Test
    public void testIsSimilarXml8() {
        Assert.assertFalse(StringRspec.isSimilarXml(TestRspecsLibrary.testSamerspeclinkA, TestRspecsLibrary.testSamerspecAdiffF)); //missing link
    }
}
