-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for remarks in let statements (#216)
* Added support for remarks in let statements. resolves #169.
- Loading branch information
1 parent
37089cd
commit 98a2c53
Showing
14 changed files
with
319 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
core/src/test/java/gov/nist/secauto/metaschema/core/model/xml/impl/ModelFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* SPDX-FileCopyrightText: none | ||
* SPDX-License-Identifier: CC0-1.0 | ||
*/ | ||
|
||
package gov.nist.secauto.metaschema.core.model.xml.impl; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertAll; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import gov.nist.secauto.metaschema.core.metapath.StaticContext; | ||
import gov.nist.secauto.metaschema.core.model.constraint.ILet; | ||
import gov.nist.secauto.metaschema.core.model.constraint.ISource; | ||
import gov.nist.secauto.metaschema.core.model.xml.xmlbeans.ConstraintLetType; | ||
import gov.nist.secauto.metaschema.core.model.xml.xmlbeans.RemarksType; | ||
|
||
import org.apache.xmlbeans.XmlException; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.net.URI; | ||
|
||
import javax.xml.namespace.QName; | ||
|
||
class ModelFactoryTest { | ||
|
||
@SuppressWarnings("null") | ||
@Test | ||
void letTest() throws XmlException { | ||
ISource source = ISource.externalSource(StaticContext.builder() | ||
.baseUri(URI.create("https://example.com/")) | ||
.build()); | ||
|
||
String variable = "var1"; | ||
String expression = "1 + 1"; | ||
RemarksType remarks = RemarksType.Factory.parse("<p>Test</p>"); | ||
|
||
ConstraintLetType letObj = ConstraintLetType.Factory.newInstance(); | ||
letObj.setExpression(expression); | ||
letObj.setVar(variable); | ||
letObj.setRemarks(remarks); | ||
|
||
ILet let = ModelFactory.newLet(letObj, source); | ||
assertAll( | ||
() -> assertEquals(new QName(variable), let.getName()), | ||
() -> assertEquals(expression, let.getValueExpression().getPath()), | ||
() -> assertEquals(source, let.getSource()), | ||
() -> assertEquals("Test", let.getRemarks().toMarkdown())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.