mil.dod.th.ose.lexicon.doc/test/mil/dod/th/ose/lexicon/doc/parser/TestLexiconParser.java
@Test
    public void testParseXsdFiles() throws ParserConfigurationException, SAXException, IOException
    {
        final List<File> xsdFiles = new ArrayList<>();
        xsdFiles.add(m_XsdFile1);
        xsdFiles.add(m_XsdFile2);
        
        List<LexiconBase> types = m_SUT.parserXsdFiles(xsdFiles, m_DocBuilder);
        Collections.sort(types, new LexiconComparator());
        
        LexiconComplexType complexType = (LexiconComplexType)types.get(0);
        assertThat(complexType.getName(), is("CompType"));
        assertThat(complexType.getExtension(), is("Base"));
        assertThat(complexType.getDescription(), is("Some description of the complex type!"));
        
        LexiconAttribute attribute = complexType.getAttributes().get(0);
        assertThat(attribute.getName(), is("attrb1"));
        assertThat(attribute.getType(), is("boolean"));
        assertThat(attribute.getUse(), is("optional"));
        assertThat(attribute.getDescription(), is("Some description of the attribute!"));
        
        LexiconElement element = complexType.getElements().get(0);
        assertThat(element.getName(), is("element1"));
        assertThat(element.getType(), is("SomeType"));
        assertThat(element.getMinOccurs(), is("0"));
        assertThat(element.getMaxOccurs(), is("1"));
        assertThat(element.getDescription(), is("Some description of the element!"));
        
        LexiconSimpleType simpleType = (LexiconSimpleType)types.get(1);
        assertThat(simpleType.getName(), is("SimpType"));
        assertThat(simpleType.getType(), is("double"));
        assertThat(simpleType.getDescription(), is("Some description of the simple type!"));
        assertThat(simpleType.getMinInclusive(), is("0.0"));
        assertThat(simpleType.getMaxInclusive(), is("360.0"));
        
        LexiconSimpleType simpleTypeEnum = (LexiconSimpleType)types.get(2);
        assertThat(simpleTypeEnum.getName(), is("SimpTypeEnum"));
        assertThat(simpleTypeEnum.getType(), is("string"));
        assertThat(simpleTypeEnum.getDescription(), is("Some description of the enum simple type!"));
        
        LexiconEnum enum1 = simpleTypeEnum.getEnumerations().get(0);
        assertThat(enum1.getName(), is("ONE"));
        assertThat(enum1.getDescription(), is("Some description of the enum ONE!"));
        
        LexiconEnum enum2 = simpleTypeEnum.getEnumerations().get(1);
        assertThat(enum2.getName(), is("TWO"));
        assertThat(enum2.getDescription(), is("Some description of the enum TWO!"));
    }
/**
     * Verify that mocked files are parsed correctly and have the correct structure.
     */
Verify that mocked files are parsed correctly and have the correct structure.
Verify that mocked files are parsed correctly and have the correct structure .
@Test
    public void testParseXsdFiles() throws ParserConfigurationException, SAXException, IOException
    {
        final List<File> xsdFiles = new ArrayList<>();
        xsdFiles.add(m_XsdFile1);
        xsdFiles.add(m_XsdFile2);
        List<LexiconBase> types = m_SUT.parserXsdFiles(xsdFiles, m_DocBuilder);
        Collections.sort(types, new LexiconComparator());
        LexiconComplexType complexType = (LexiconComplexType)types.get(0);
        assertThat(complexType.getName(), is("CompType"));
        assertThat(complexType.getExtension(), is("Base"));
        assertThat(complexType.getDescription(), is("Some description of the complex type!"));
        LexiconAttribute attribute = complexType.getAttributes().get(0);
        assertThat(attribute.getName(), is("attrb1"));
        assertThat(attribute.getType(), is("boolean"));
        assertThat(attribute.getUse(), is("optional"));
        assertThat(attribute.getDescription(), is("Some description of the attribute!"));
        LexiconElement element = complexType.getElements().get(0);
        assertThat(element.getName(), is("element1"));
        assertThat(element.getType(), is("SomeType"));
        assertThat(element.getMinOccurs(), is("0"));
        assertThat(element.getMaxOccurs(), is("1"));
        assertThat(element.getDescription(), is("Some description of the element!"));
        LexiconSimpleType simpleType = (LexiconSimpleType)types.get(1);
        assertThat(simpleType.getName(), is("SimpType"));
        assertThat(simpleType.getType(), is("double"));
        assertThat(simpleType.getDescription(), is("Some description of the simple type!"));
        assertThat(simpleType.getMinInclusive(), is("0.0"));
        assertThat(simpleType.getMaxInclusive(), is("360.0"));
        LexiconSimpleType simpleTypeEnum = (LexiconSimpleType)types.get(2);
        assertThat(simpleTypeEnum.getName(), is("SimpTypeEnum"));
        assertThat(simpleTypeEnum.getType(), is("string"));
        assertThat(simpleTypeEnum.getDescription(), is("Some description of the enum simple type!"));
        LexiconEnum enum1 = simpleTypeEnum.getEnumerations().get(0);
        assertThat(enum1.getName(), is("ONE"));
        assertThat(enum1.getDescription(), is("Some description of the enum ONE!"));
        LexiconEnum enum2 = simpleTypeEnum.getEnumerations().get(1);
        assertThat(enum2.getName(), is("TWO"));
        assertThat(enum2.getDescription(), is("Some description of the enum TWO!"));
    }
@ Test public void testParseXsdFiles ( ) throws ParserConfigurationException , SAXException , IOException { final List < File > xsdFiles = new ArrayList < > ( ) ; xsdFiles . add ( m_XsdFile1 ) ; xsdFiles . add ( m_XsdFile2 ) ; List < LexiconBase > types = m_SUT . parserXsdFiles ( xsdFiles , m_DocBuilder ) ; Collections . sort ( types , new LexiconComparator ( ) ) ; LexiconComplexType complexType = ( LexiconComplexType ) types . get ( 0 ) ; assertThat ( complexType . getName ( ) , is ( "CompType" ) ) ; assertThat ( complexType . getExtension ( ) , is ( "Base" ) ) ; assertThat ( complexType . getDescription ( ) , is ( "Some description of the complex type!" ) ) ; LexiconAttribute attribute = complexType . getAttributes ( ) . get ( 0 ) ; assertThat ( attribute . getName ( ) , is ( "attrb1" ) ) ; assertThat ( attribute . getType ( ) , is ( "boolean" ) ) ; assertThat ( attribute . getUse ( ) , is ( "optional" ) ) ; assertThat ( attribute . getDescription ( ) , is ( "Some description of the attribute!" ) ) ; LexiconElement element = complexType . getElements ( ) . get ( 0 ) ; assertThat ( element . getName ( ) , is ( "element1" ) ) ; assertThat ( element . getType ( ) , is ( "SomeType" ) ) ; assertThat ( element . getMinOccurs ( ) , is ( "0" ) ) ; assertThat ( element . getMaxOccurs ( ) , is ( "1" ) ) ; assertThat ( element . getDescription ( ) , is ( "Some description of the element!" ) ) ; LexiconSimpleType simpleType = ( LexiconSimpleType ) types . get ( 1 ) ; assertThat ( simpleType . getName ( ) , is ( "SimpType" ) ) ; assertThat ( simpleType . getType ( ) , is ( "double" ) ) ; assertThat ( simpleType . getDescription ( ) , is ( "Some description of the simple type!" ) ) ; assertThat ( simpleType . getMinInclusive ( ) , is ( "0.0" ) ) ; assertThat ( simpleType . getMaxInclusive ( ) , is ( "360.0" ) ) ; LexiconSimpleType simpleTypeEnum = ( LexiconSimpleType ) types . get ( 2 ) ; assertThat ( simpleTypeEnum . getName ( ) , is ( "SimpTypeEnum" ) ) ; assertThat ( simpleTypeEnum . getType ( ) , is ( "string" ) ) ; assertThat ( simpleTypeEnum . getDescription ( ) , is ( "Some description of the enum simple type!" ) ) ; LexiconEnum enum1 = simpleTypeEnum . getEnumerations ( ) . get ( 0 ) ; assertThat ( enum1 . getName ( ) , is ( "ONE" ) ) ; assertThat ( enum1 . getDescription ( ) , is ( "Some description of the enum ONE!" ) ) ; LexiconEnum enum2 = simpleTypeEnum . getEnumerations ( ) . get ( 1 ) ; assertThat ( enum2 . getName ( ) , is ( "TWO" ) ) ; assertThat ( enum2 . getDescription ( ) , is ( "Some description of the enum TWO!" ) ) ; }
Verify that mocked files are parsed correctly and have the correct structure.
Verify that mocked files are parsed correctly and have the correct structure .