/*
 * Copyright (c) 2021 by Oliver Boehm
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * (c)reated 13.01.2021 by oboehm
 */

package gdv.xport.util;

import org.junit.Test;

import javax.xml.stream.XMLStreamException;

import static org.junit.Assert.*;

/**
 * Unit-Tests fuer {@link XmlSatzFactory}.
 *
 * @author oboehm
 * @since 5.0 (13.01.2021)
 */
public final class XmlSatzFactoryTest {

    @Test
    public void testGetInstance2015() {
        XmlSatzFactory factory = XmlSatzFactory.getInstance("VUVM2015.xml");
        assertNotNull(factory);
    }

    @Test
    public void testGetSameInstance() {
        XmlSatzFactory f1 = XmlSatzFactory.getInstance();
        XmlSatzFactory f2 = XmlSatzFactory.getInstance();
        assertSame(f1, f2);
    }

    @Test
    public void testGetDifferentInstances() {
        XmlSatzFactory f2015 = XmlSatzFactory.getInstance("VUVM2015.xml");
        XmlSatzFactory f2018 = XmlSatzFactory.getInstance("VUVM2018.xml");
        assertNotEquals(f2015, f2018);
    }

}

@@ -657,16 +657,167 @@
 .util;%0A%0A
+import gdv.xport.feld.Bezeichner;%0Aimport gdv.xport.feld.Feld;%0Aimport gdv.xport.satz.Datensatz;%0Aimport gdv.xport.satz.Vorsatz;%0Aimport org.junit.Ignore;%0A
 import o
@@ -1671,10 +1671,767 @@
 %0A    %7D%0A%0A
+    @Test%0A    @Ignore // noch nicht implementiert%0A    public void testVorsatz2015() %7B%0A        XmlSatzFactory f2015 = XmlSatzFactory.getInstance(%22VUVM2015.xml%22);%0A        assertEquals(%221.1%22, getVersionSatzart0052(f2015));%0A    %7D%0A%0A    @Test%0A    public void testVorsatz2018() %7B%0A        XmlSatzFactory f2018 = XmlSatzFactory.getInstance(%22VUVM2018.xml%22);%0A        assertEquals(%221.2%22, getVersionSatzart0052(f2018));%0A    %7D%0A%0A    private String getVersionSatzart0052(XmlSatzFactory factory) %7B%0A        Datensatz satz = factory.getDatensatz(SatzTyp.of(%220001%22));%0A        Vorsatz vorsatz = new Vorsatz(satz);%0A        vorsatz.setVersion(SatzTyp.of(%220052%22));%0A        Feld version = vorsatz.getFeld(Bezeichner.VERSION_SATZART_0052);%0A        return version.getInhalt();%0A    %7D%0A%0A
 %7D%0A

Test f. Factory-spezifischen Vorsatz vorbereitet